MyBB Community Forums

Full Version: [SOLVED]MyBB logged condition
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi guys,

I looking after the condition which will determine if the user is logged or is simple guest .
In vBulletin I had something like this :

<if condition="$show['member']">

Here, for myBB, what is the function ?

Kind regards guys Toungue
You can't use anything like that with MyBB's template engine. Maybe somethin like that is coming in 2.0 (i don't know if TWIG supports that, but i know SMARTY does).
Hei pyridine , that plugin\mode contain -->

; List of allowed functions for Template Conditionals plugin
; Note that although comments start with a ";" character, they aren't exactly ignored by the plugin
;  rather, no function can start with a ";", so it'll never match

array_change_key_case
array_chunk
array_combine
array_count_values
array_diff_assoc
array_diff_key
array_diff
array_fill_keys
array_fill
array_flip
array_intersect_assoc
array_intersect_key
array_intersect
array_key_exists
array_keys
array_merge_recursive
array_merge
array_multisort
array_pad
array_product
array_rand
array_reverse
array_search
array_slice
array_sum
array_unique
array_values
array
count
current
each
end
in_array
key
next
pos
prev
range
reset
sizeof
get_class
get_object_vars
get_parent_class
is_a
is_subclass_of
method_exists
property_exists
date
getdate
gettimeofday
gmdate
gmmktime
gmstrftime
idate
localtime
microtime
mktime
strftime
strptime
strtotime
time
abs
acos
acosh
asin
asinh
atan2
atan
atanh
base_convert
bindec
ceil
cos
cosh
decbin
dechex
decoct
deg2rad
exp
expm1
floor
fmod
getrandmax
hexdec
hypot
is_finite
is_infinite
is_nan
lcg_value
log10
log1p
log
max
min
mt_getrandmax
mt_rand
octdec
pi
pow
rad2deg
rand
round
sin
sinh
sqrt
tan
tanh
get_browser
highlight_string
pack
uniqid
unpack
preg_grep
preg_quote
preg_split
version_compare
addcslashes
addslashes
bin2hex
chop
chr
chunk_split
convert_cyr_string
convert_uudecode
convert_uuencode
count_chars
crc32
crypt
explode
get_html_translation_table
hebrev
hebrevc
html_entity_decode
htmlentities
htmlspecialchars_decode
htmlspecialchars
implode
join
levenshtein
localeconv
ltrim
md5
metaphone
money_format
nl_langinfo
nl2br
number_format
ord
quoted_printable_decode
quotemeta
rtrim
sha1
similar_text
soundex
sprintf
str_getcsv
str_ireplace
str_pad
str_repeat
str_replace
str_rot13
str_shuffle
str_split
str_word_count
strcasecmp
strchr
strcmp
strcoll
strcspn
strip_tags
stripcslashes
stripos
stripslashes
stristr
strlen
strnatcasecmp
strnatcmp
strncasecmp
strncmp
strpbrk
strpos
strrchr
strrev
strripos
strrpos
strspn
strstr
strtok
strtolower
strtoupper
strtr
substr_compare
substr_count
substr_replace
substr
trim
ucfirst
ucwords
wordwrap
unicode_decode
unicode_encode
base64_decode
base64_encode
get_headers
http_build_query
parse_url
rawurldecode
rawurlencode
urldecode
urlencode
doubleval
empty
floatval
gettype
intval
is_array
is_binary
is_bool
is_buffer
is_double
is_float
is_int
is_integer
is_long
is_null
is_numeric
is_object
is_real
is_resource
is_scalar
is_string
is_unicode
isset
strval
utf8_decode
utf8_encode
gzcompress
gzdecode
gzdeflate
gzencode
gzinflate
gzuncompress

;MyBB functions
add_breadcrumb
alt_trow
ban_date2timestamp
build_archive_link
build_profile_link
convert_through_utf8
dec_to_utf8
;escaped_explode
fetch_ban_times
fetch_longipv4_range
fetch_page_url
fix_mktime
format_bdays
format_name
generate_post_check
get_age
get_announcement_link
get_attachment_icon
get_bdays
get_calendar_link
get_calendar_week_link
get_colored_warning_level
get_current_location
get_event_date
get_event_link
get_event_poster
get_extension
get_forum
get_forum_link
get_friendly_size
get_inactive_forums
get_ip
get_parent_list
get_post
get_post_link
get_profile_link
get_reputation
get_thread
get_thread_link
get_unviewable_forums
get_user
get_weekday
htmlspecialchars_uni
is_banned_email
is_banned_ip
is_banned_username
is_moderator
is_super_admin
match_sequence
multipage
my_date
my_get_array_cookie
my_ip2long
my_long2ip
my_number_format
my_rand
my_strlen
my_strpos
my_strtolower
my_strtoupper
my_substr
my_wordwrap
nice_time
random_str
reset_breadcrumb
signed
subforums_count
trim_blank_chrs
unhtmlentities
unichr
unicode_chr
user_permissions
usergroup_permissions
validate_email_format

;PHPTPL funcions
phptpl_eval_expr
phptpl_eval_text

;mb_*
;ob_* ?
;print_r / var_dump / serialize / unserialize ?

Show me the function wich I requested .
There is no function for what I requested... I don't see it .. exemple:

is_banned_email
is_banned_ip
is_banned_username
is_moderator
is_super_admin

is_logged ? is_user ?

How I can use this to create a condition which will determine if the user is logged or is simple guest ?
It this possible?
Because I can't install something wich I will not use :p
this tells you if the user is logged in

$mybb->user['uid'] > 0
Without the plugin that pyridine post it?
And.. how I make the condition in the template , for exemple:
<li><a href="{$mybb->settings['bburl']}/usercp.php">{$lang->welcome_usercp}</a></li>

I want to put \ make the condition for user : if he is logged or is guest .
How I do that?
For exemple, I make this way? :

<if({$mybb->user['uid'] > 0})>SOMETHING HERE</if>

Or :

<if condition="$mybb->user['uid'] > 0">SOMETHING HERE</if>

Or :

<if="$mybb->user['uid'] > 0">SOMETHING HERE</if> 

?????

For you to understand , I look to see how the mybb language works, if I see a exemple for what I request, atfer will be so simple....
try

<if $mybb->user['uid'] then>
</if>
I try this way -->
<if $mybb->user['uid'] then>
					<li><a href="{$mybb->settings['bburl']}/usercp.php">{$lang->welcome_usercp}</a></li>
</if>

And doesn't work ...
This kind of condition is very but very usefull because I can make everywhere I want buttons and not only , only for guest or only for members , for this reason I needed .
I know that the myBB platform contain some templates that are showed only to the guest or only to the members, moderators, admins but how I say before I want to be able to customize everywhere not only in those templates .

PS: Sorry for my bad english .
i am not too familiar with the plugin, but i think you need to change from template conditionals to php in templates for this to work.

someone else familiar will have to help from here
Hei , do you mean that I must install this http://mybbhacks.zingaburga.com/showthread.php?tid=464 and after to try your suggestion ?
Because I don't install that (yet) :p

EDIT


I install this : http://mybbhacks.zingaburga.com/showthread.php?tid=464
After i try this :

<if $mybb->user['uid'] then>
                    <li><a href="{$mybb->settings['bburl']}/usercp.php">{$lang->welcome_usercp}</a></li>
</if> 

And it's working !!!

+reputation and many thanks pavemen and pyridine !!!
Pages: 1 2