MyBB Hacks

Full Version: PHP in Templates / Complex Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
(05-13-2016 07:02 AM)Salakiss Wrote: [ -> ]Hello !

I'm trying to hide a custom profile field of the user profile, so i just look for help.

fid7 = is a select box required on registration but i don't want to be changed on user profile

Can anyone help me please ?



Sorry for my english, i'm french.

Try this.

Open usercp_profile_customfield template and replacing everything with

PHP Code:
<if $profilefield['fid'] == 7 then>
<else>
<tr>
<td>
<span>{$profilefield['name']}</span>:
<br />
<span class="smalltext">{$profilefield['description']}</span>
</td>
</tr>
<tr>
<td>{$code}</td>
</tr>
</if>

(03-28-2016 01:22 AM)DrXotick Wrote: [ -> ]So we are now using this:

Code:
<if ($postcounter == 1) && in_array($fid, array(68)) && ($post['pid'] > 53109) then>
<hr class="style-four">
<strong>Budget: </strong>{$GLOBALS['threadfields']['budget']}<br />
<strong>Countries: </strong>{$GLOBALS['threadfields']['country']}<br />
<hr class="style-four">
</if>


And it works... Is this okay?? Or will cause some problem?

Well, it works, so there's no problem?

(05-12-2016 12:04 PM)Marisa Wrote: [ -> ]Having an issue with the following code, IP simply doesn't display and code itself appears greyed out in the editor.

PHP Code:
<span>Connected via:</span> <?php echo $_SERVER['HTTP_X_FORWARDED_FOR']; ?>


Nginx and PHP7.0 aren't throwing any errors whatsoever in the logs either... Erf

Use echo get_ip(); instead?

(05-13-2016 07:02 AM)Salakiss Wrote: [ -> ]I'm trying to hide a custom profile field of the user profile, so i just look for help.

fid7 = is a select box required on registration but i don't want to be changed on user profile
This plugin won't help you with that.  You could theoretically hide the field, but it won't stop users changing it.
Im trying to do this but does not work:

PHP Code:
				
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*365))</setvar>
  <if $post['tplvars']['years'] == 0 then>
	<div></div>
     <else>
	<div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;">
		<span style="color:gold" class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} ANOS DE SERVIÇO</span>
	</div>
  </if>
<setvar moths>floor((TIME_NOW-$post['regdate'])/(60*60*24*30))</setvar>
   <if ($post['tplvars']['moths'] > 0) then>
	<div class="postbit-time postbit-time-halfyear" style="margin-top: 3px;">
	        <span style="color:purple" class="service-{$GLOBALS['tplvars']['moths']}">{$GLOBALS['tplvars']['moths']} MESES DE SERVIÇO</span>
        </div>
  </if>

Only equal (=) and not equal (!=) works, less than or equal to (<=) and greater than or equal to (>=) doesn't.
how to make this work? Thanks!

I'm trying to give the owner of my forums a tag, however, it doesn't seem to be working and is giving the tag to everyone.
plugin: http://mybbhacks.zingaburga.com/showthread.php?tid=260

Code:
<if $user['uid'] = 25 then><span style="color: red;">OWNER OF Forumsname</span></if>


Is $user['uid'] not the correct tag?
I've also tried $post['uid']

hi , i am having this error:



Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /inc/plugins/phptpl.php on line 136
Hello!

For my forum I'm testing some plugins. This one is on our list. The users are able to say thank you to the first posts of threads in a certain forum. If they do so I'd like to put a specific note into the header_welcomeblock_member template.
Does someone know which variables I'd have to use with the following code?

PHP Code:
<if "thank you in thread with the ID x" then>some text
<else />another text</if>


Thinking about the first question another one pops up. In general: what variables can I use for stuff like the above? Is there a way to "find" the ones from plugins or the original MyBB codes in the files?

TBH, I don't know the plugin. My guess is it doesn't provide the variable (I may be wrong). I think it is better for you to ask the plugin author?
I followed your advice and am waiting now for a response.
But my other question is still the same: in general how to I find variables that I can use for this?
What do you mean by "in general"? If you still refer to the plugin,

(02-15-2017 02:47 AM)RateU Wrote: [ -> ]My guess is it doesn't provide the variable (I may be wrong).

If later you have the variable, just use it inside your if condition.
Maybe I wasn't clear enough with the second question. ^^ That one has nothing to do with the plugin, just for the general use of the possible variables and how to find them. Do I have to use the column-names of the ones in the database (hope it's the right word, English is not my mother tongue) or something like that? For usergroups it seems to work like that. So I just wanted to know how to "get" them. ^^
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Reference URL's