Timeline for How to add the current user's user id in query of a custom field for a plugin?
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 25, 2020 at 20:21 | vote | accept | BJamieson | ||
Mar 25, 2020 at 20:11 | answer | added | Robbie Jackson | timeline score: 0 | |
Mar 25, 2020 at 20:08 | vote | accept | BJamieson | ||
Mar 25, 2020 at 20:21 | |||||
Mar 25, 2020 at 19:55 | answer | added | Sharky | timeline score: 0 | |
Mar 25, 2020 at 17:40 | comment | added | FFrewin | BJamieshon & @ThiagoGuimarães Please read how Stack Exchnage sites work tour & help center. Avoid opening a discussion or information exchange via new answers. This is not permitted. In short the format is: OP creates a question, users post solutions or valuable information as answers. Clarifications asked/delivered or new questions in the answers sections are not allowed. This isn't a forum. Any clarifications can be asked via a comment and updated info regarding the problem can be added into the question's body. Topics should bind to 1 problem, and not expand to new problems that might occur. | |
Mar 25, 2020 at 17:33 | history | edited | FFrewin | CC BY-SA 4.0 |
appended answer 26839 as supplemental
|
Mar 25, 2020 at 16:19 | answer | added | Thiago Guimarães | timeline score: 0 | |
Mar 25, 2020 at 13:22 | history | edited | BJamieson | CC BY-SA 4.0 |
Tried to clarify that the created_by clause in sql was the 'hardwired' bit. Updated the question with more approaches that I've tried.
|
Mar 25, 2020 at 11:42 | comment | added | BJamieson |
I've tried putting on developer level logging, etc. If the SELECT contains the hardwired clause AND created_by = 305 , it works, but if I adapt the clause to be created_by = %%userid%% and I also have the substitution code if (substr_count($value,"%%userid%%") > 0){ $userid = JFactory::getUser()->id; str_replace("%%userid%%", $userid, $query); } the substitution does not happen, the debug database section tells me that the SQL statement is wrong (of course), and the picklist of items is not created.
|
|
S Mar 25, 2020 at 11:21 | comment | added | Thiago Guimarães | What's the error you are getting? | |
S Mar 25, 2020 at 11:21 | comment | added | Thiago Guimarães | What's the error you are getting? | |
Mar 25, 2020 at 0:57 | comment | added | mickmackusa | Everyone is at different technical levels in their Joomla journey -- this is totally okay. Please edit your question to include any new relevant details (instead of commenting them). I am at work right now and don't have any means to directly assist. Where exactly are you doing your "hard-wiring"? | |
Mar 25, 2020 at 0:41 | comment | added | BJamieson |
Hi @mickmackusa, Thanks for the editing clarification. Shall try better but erk, this is all a bit modern ;-) This code fails too - do NOT understand why: $query = $fieldParams->get('query', ''); // Run the query with a having condition because it supports aliases $db->setQuery($query . ' AND created_by =' . $db->q( 305 )); It doesn't like double spaces at the end of a line then ;-)
|
|
Mar 25, 2020 at 0:04 | history | edited | mickmackusa | CC BY-SA 4.0 |
formatting, more specificity in title, added tags
|
Mar 24, 2020 at 17:45 | review | First posts | |||
Mar 25, 2020 at 0:05 | |||||
Mar 24, 2020 at 17:44 | history | asked | BJamieson | CC BY-SA 4.0 |