Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2111

phpBB Custom Coding • Re: A tag to hide text for users but not modos/admin ?

$
0
0
Hi,

For want of finding anything cleaner, I finally used user rank_id and coded in viewtopic.php:

After:

Code:

// Start session management$user->session_begin();$auth->acl($user->data);
Added:

Code:

$userrank = $user->data['user_rank']; // Modif Couin
After:

Code:

// Parse the message and subject$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;$message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
Added:

Code:

if ( $userrank != 1 ) { // Modif Couinwhile ( strpos($message, '[HideMe]') !== false ) {$posstart = strpos($message, '[HideMe]');$posend = strpos($message, '[/HideMe]') + strlen('[/HideMe]');$hidelen = $posend - $posstart;$message = substr_replace($message, '', $posstart, $hidelen);}} else {$message = str_replace('[HideMe]', '', $message);$message = str_replace('[/HideMe]', '', $message);}
Results:
Message body:
[HideMe]pic@pouet.fr
[/HideMe]grouik grouik grouik
Admin view:
pic@pouet.fr
grouik grouik grouik
Users/guests view:
grouik grouik grouik

Just I have to remember to redo the modification on forum update :lol:

Statistics: Posted by Couin — Fri Oct 18, 2024 3:23 pm



Viewing all articles
Browse latest Browse all 2111

Trending Articles