Solved.
Variables won't work?
|
2015-08-30, 01:16 PM
Still looking for help on this one. If for example enter the variable {$history_date} it won't display anything (yes, i've made it so once a user logins, it will insert the date into the database)
I'm clueless.
2015-09-02, 10:03 PM
Can you show me the template you're using?
2015-09-02, 10:59 PM
Use usercp_end instead for your hook.
2015-09-03, 12:02 AM
(This post was last modified: 2015-09-03, 12:03 AM by Destroy666.)
Not sure if the hook matters (I think it's fine), but your code is wrong in several other places:
1. You're selecting only the dateline column in the simple_select() query, yet you're trying to use the lastip column. Both need to be selected. 2. $history_date tries to use undefined $loginhistory, which should be $history like in the loop. And why are you using date() instead of MyBB's my_date()? Also, (int) casting is more preferred than intval(). Your function name is not really unique and may conflict with other plugins.
2015-09-03, 06:35 PM
(This post was last modified: 2015-09-03, 06:36 PM by Destroy666.)
You didn't show the template as someone requested. Can't tell more without it. The loginhistory database structure would help too. Also, where do you insert {$history}? Are you sure it's inserted correctly?
But another mistake I can see is that the loop goes $mybb->settings['showhistory'] times, but the template is called only one time, even if the setting is 0. $history_date gets overwritten several times and the last value is probably used in the template, which is never going to work as supposed to. A template should be concatenated to a variable several times in the loop so that all records will be displayed.
2015-09-03, 07:51 PM
(This post was last modified: 2015-09-03, 07:54 PM by Destroy666.)
Does the plugin install without any errors? Never heard of smallintval/bigintval column types in any DB system we support.
And the template logic is wrong as I suspected - you can't loop through several records and output them only once in a template. You need to separate this: into another template and then concantenate it to a variable each time. Then output that variable in the main template.
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 7 Guest(s)