vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   (Simple enough) Change from php code in plugin to template code (https://vborg.vbsupport.ru/showthread.php?t=244736)

basketmen 06-16-2010 04:42 PM

(Simple enough) Change from php code in plugin to template code
 
This is a conditional code in a plugin,

if(($thread['postuserid'] == $this->registry->userinfo['userid']) OR ($this->registry->userinfo['permissions']['answers_forum_perms'] & $this->registry->bf_ugp_answers_forum_perms['canselect_others_answers'])){
}

i want to put it in template, is this right guys? because i think this is not fully working

<if condition="$thread['postuserid'] == $this->registry->userinfo['userid'] OR $this->registry->userinfo['permissions']['answers_forum_perms'] & $this->registry->bf_ugp_answers_forum_perms['canselect_others_answers']">
</if>

regrads

BirdOPrey5 06-16-2010 05:26 PM

In the template conditional I would use 'AND' instead of & but either may work... I know 'AND' does and you already use 'OR' - also I would use brackets () to make the logic easier to follow.

Lynne 06-16-2010 07:35 PM

Definitely need to put your brackets back in for the OR part just like in the original.

noppid 06-16-2010 07:54 PM

Looks fine. It should work with or without the grouping Lynne suggests. Making them explicit can be faster though.

<if condition="($thread['postuserid'] == $this->registry->userinfo['userid']) OR ($this->registry->userinfo['permissions']['answers_forum_perms'] & $this->registry->bf_ugp_answers_forum_perms['canselect_others_answers'])">
</if>

Do not change the & to AND. It is a bitwise arithmetic operation. AND is a logical operator.

BirdOPrey5 06-16-2010 08:11 PM

my bad... :confused:

noppid 06-16-2010 08:15 PM

We all have to learn nuances. I've made worse mistakes.

In the if condition AND would be && using ampersands instead of text.


All times are GMT. The time now is 05:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01041 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete