Dan

Constituant
  • Content Count

    76
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Dan

  1. I have created a rule that does an action when a topic is hidden, but unfortunately I can;t seem to load the post object to get the post content because a topic doesn't contain that information. To be perfectly honest I don't even know where to find documentation on all the class namespaces, so I have kind of been guessing most the way. What am i doing wrong here? $post = \IPS\Content\Item::load( $content->topic_firstpost ); Is what I'm doing not even possible?
  2. For anyone curious in the future its this: $post = \IPS\forums\Topic\Post::load( $content->topic_firstpost );
  3. Hi, I was wondering if there is any ability to list the available balance in the user postbit for a points system rather than the total (which includes the amount stored in banks, i think referred to as "worth") currencyUserBit Template <a _title="{$currency->_title}" data-ipsTooltip class="ipsSpacer_top ipsSpacer_half ipsBadge ipsBadge_small ipsBadge_{{if $worth < 0}}style5{{else}}style4{{endif}}" href='{url="app=points&module=points&controller=economy&do=statistics&currency={$currency->id}"}'> {$currency->display( $worth )} {$currency->pluralized( $worth )} </a> I want to display the available balance rather than worth, but I dont think the variable ($balance) is available for this particular template? How would I go about changing that? {$balance->currency()->display( $balance->available )}
  4. Dan

    Available balance in postbit

    I ended up finding this valuable resource hidden away on the site: Final solution for anyone wondering: <a _title="{$currency->_title}" data-ipsTooltip class="ipsSpacer_top ipsSpacer_half ipsBadge ipsBadge_small ipsBadge_{{if $member->balance(1,0)->available< 0}}style5{{else}}style4{{endif}}" href='{url="app=points&module=points&controller=economy&do=statistics&currency={$currency->id}"}'> {$currency->display( $member->balance(1,0)->available )} {$currency->pluralized( $member->balance(1,0)->available )} </a>
  5. Hi, Just wanted to report an issue where the event "Event: Topic has been created" is triggered when a topic is moved and the checkbox is selected to create a redirect to its new location. Could we perhaps have this changed to not trigger on those cases?
  6. Dan

    Available balance in postbit

    @Kevin Carwile when you get a chance could you move this to the support section? I need a little bit of guidance regarding passing variables to templates, so that I can complete my desired result. I haven't had any luck with the IPS4 docs.
  7. Ok so I cant edit my previous posts, but I finally found a solution. I have deduced that the default value for a post state is open. Therefore setting an event condition to check for the state value wont work due to it always being open. Therefore, its not until "Defer To Page End" that the state has been set correctly. So I manipulate my action code to check the state of the content before processing the action code, and obviously have it triggered at point "Defer To Page End".
  8. I wish i could find the file where the event is define to investigate
  9. Update: Event trigger doesnt pick up the link as a new topic. It appears that the code triggers a new post when the topic is moved, despite keeping the same id. Odd. Back to the drawing board!
  10. Hi All, To anyone who is reading this and wants a solution. As per Kevins guidance above, I was able to locate the following: The state field in the database for topic's stores the value "link" when saving a link. Usually this field has the value of open or close, which defines the post being locked or not, etc. Keep in mind i didn't know how to deconstruct the object any other way than to view the database table for forum_topics. Hope this helps anyone in the future!
  11. I understand that, but is it possible for me to edit your application files to only accept the event trigger associated to a new topic rather than a redirect topic? im sure I could look in the db and find a field or something associated to redirect topics to destinguish them. where would I locate the event trigger files? This is kind of important to my use case for this product as I use this particular event trigger to report to somewhere else for management purposes. I have a very large community so it’s triggered fairly regularly for redirects.
  12. Dan

    Fixing the IPS4 Number field decimals bug

    Thanks, good to know! It helps in one of my projects!
  13. When i clear cache and disable the rules application, the error in system log is different, confirming it has nothing to do with the rules application. Will go back to IPS support, cheers! Error: Call to a member function content() on null (0) #0 /var/www/html/applications/forums/sources/Topic/Topic.php(1902): IPS\Content\_Item->metaDescription(NULL) #1 /var/www/html/system/Content/Controller.php(242): IPS\forums\_Topic->metaDescription() #2 /var/www/html/applications/forums/modules/front/forums/topic.php(50): IPS\Content\_Controller->manage() #3 /var/www/html/system/Dispatcher/Controller.php(96): IPS\forums\modules\front\forums\_topic->manage() #4 /var/www/html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #5 /var/www/html/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute() #6 /var/www/html/system/Dispatcher/Dispatcher.php(146): IPS\forums\modules\front\forums\_topic->execute() #7 /var/www/html/index.php(13): IPS\_Dispatcher->run() #8 {main}
  14. Error: Call to a member function content() on null (0) #0 /var/www/html/applications/forums/sources/Topic/Topic.php(1902): IPS\Content\_Item->metaDescription(NULL) #1 /var/www/html/system/Content/Controller.php(242): IPS\forums\_Topic->metaDescription() #2 /var/www/html/init.php(458) : eval()'d code(15): IPS\Content\_Controller->manage() #3 /var/www/html/applications/forums/modules/front/forums/topic.php(50): IPS\Content\rules_hook_ipsContentController->manage() #4 /var/www/html/system/Dispatcher/Controller.php(96): IPS\forums\modules\front\forums\_topic->manage() #5 /var/www/html/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #6 /var/www/html/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute() #7 /var/www/html/system/Dispatcher/Dispatcher.php(146): IPS\forums\modules\front\forums\_topic->execute() #8 /var/www/html/index.php(13): IPS\_Dispatcher->run() #9 {main} I have a growing number of topics that can no longer be opened on my forum. I opened a ticket with IPS support and they diagnosed the problem to be with the rules application. I have tried disabling/enabling/upgrading the application without any success. It appears something with the metaDescription on all the effected topics is broken? Issue with rules_hook_ipsContentController
  15. No I disabled all the applications. Let me see if it returns a slightly different error report when all are disabled. My site has cloudfront in front of it so its possible the errors are caching or something. I will do some troubleshooting, including looking for this MetaDescription field in the database, and see what values are present for the affected topics.
  16. Hi, I have added the following edit to the post container to help provide the function to tip a user based on their post: <!-- tip user custom edit --> <div class="ipsGrid_span4 ipsPad"> <a class="ipsButton ipsButton_important ipsButton_fullWidth ipsButton_small" data-ipsdialog="" data-ipsdialog-title="Tip user" href="https://forum.stake.com/index.php?app=points&amp;module=points&amp;controller=dashboard&amp;do=send&amp;curr=1&amp;bank=0&amp;bal=1" title="Tip user" id="ips_uid_5636_3"><i class="fa fa-user"></i>&nbsp;&nbsp; Tip user</a> </div> I was just wondering if there was a way to autocomplete the "send to:" input, based on the post author.
  17. Here's my hacky attempt with jquery that doesn't work, any assistance is appreciated! <!-- tip user custom edit --> <script> $('#tipUser').click(function() { $('#elInput_points_dash_transfer_member_dummyInput').val( "{$comment->author()->name}" ); }); </script> <div class="ipsGrid_span4 ipsPad"> <a class="ipsButton ipsButton_important ipsButton_fullWidth ipsButton_small" data-ipsdialog="" data-ipsdialog-title="Tip user" href="https://forum.stake.com/index.php?app=points&amp;module=points&amp;controller=dashboard&amp;do=send&amp;curr=1&amp;bank=0&amp;bal=1" title="Tip user" id="tipUser"><i class="fa fa-user"></i>&nbsp;&nbsp; Tip {$comment->author()->name}</a> </div>
  18. Dan

    8 decimal places

    I work with a forum that has a point system based on bitcoin. The bitcoin currency uses 8 decimal places, yet the points system doesn't let me go past 5. Is there any quick edit to grant the 8 decimals?
  19. Dan

    8 decimal places

    @Kevin Carwile is there anything that I can do?
  20. I am getting a 500 error when the following condition is processed. But nothing is appearing in the debugging. $tokens = \IPS\rules\Application::getTokens($operation->event(), $arg_map); $content = $tokens['[content:content]']; return strlen($content); I don't see what could possibly be wrong, how can I check the output of $content to debug?
  21. Solved, can simply use: $comment->author()->data_key
  22. Hi, I haven't ever really used the templates to add anything more than little html edits and such, so this is a bit foreign to me. I have created a custom data field with the member object. I want to display it in the postbit next to each persons comments. I understand the documentation gives me this, but I am unsure how to assign the member object for each comment. <!-- template tags --> {{if $object->data_key}} <strong>Data:</strong> {$object->data_key} {{endif}} To assign the $object would I do this? Is this on the right track? (in template PostContainer) {{ $object = \IPS\Member::load( $comment->author()->member_id ) }}
  23. Dan

    Event on Content Length

    The only problem with this is that it doesn't trigger for the topic created, only the responses/comments to it. Furthermore it counts quoted text as part of the users submission. I have provided a solution to both those things on my other topic, hopefully it helps someone
  24. Dan

    Check length of $content

    I ended up doing this: $user = \IPS\Db::i()->select('*', 'core_members', array('member_id=?', $content->author_id))->first(); $dom = new DOMDocument(); $dom->loadHTML($content->post); if ($quote = $dom->getElementsByTagName('blockquote')->item(0)) { $quote->parentNode->removeChild($quote); } $post = $dom->saveHTML(); $postlength = strlen(trim(strip_tags($post), " \t\n\r\0\x0B\xC2\xA0"));