Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 15:49

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 2 posts ] 
Author Message
PostPosted: 18 Dec 2011, 00:54 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
jQ Username BBCode with Group Colours

features
This bbcode snippet adds an pulldown with usernames,
which can be inserted in an easy way logy to postbox.
It provides group-colours and a link to profile

screen
Attachment:
username_bbcode.png
username_bbcode.png [ 30.45 KiB | Viewed 6025 times ]

demo
posting.php?mode=reply&f=2&t=10
username: test / password: testuser

Instruction

open

posting.php

find

Code:
page_footer();


before add

Code:
      // Username [BBCode] / (c) 4seven / 2011
      $sql = "SELECT user_id, username, user_colour
         FROM "
 . USERS_TABLE . "
         WHERE user_type IN ("
 . USER_FOUNDER . ', ' . USER_NORMAL . ")
         ORDER BY username_clean"
;
      $result  = $db->sql_query($sql);
   
      while 
($row = $db->sql_fetchrow($result)){

      $row['user_colour'] = (!empty($row['user_colour'])) ? $row['user_colour'] : '000000';
      $style_bold         = ($row['user_colour'] == '000000') ? 'normal' : 'bold';
      
      $template
->assign_block_vars('username_bb', array(
      'USERNAME_BB_BOLD'  => $style_bold,      
      
'USERNAME_BB_VALUE' => '|#' . $row['user_colour'] . '|' . $style_bold . '|'. $row['user_id'],
      'USERNAME_BB_USER'  => $row['username']));}
      $db->sql_freeresult($result);
      // Username [BBCode] / (c) 4seven / 2011                     


open

styles/prosilver/template/posting_buttons.html

find

Code:
    <!-- BEGIN custom_tags -->
            <input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="{custom_tags.BBCODE_TAG}" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" />
    <!-- END custom_tags -->


after add

Code:
<!-- IF not S_PRIVMSGS -->

    <script type="text/javascript">
    // <![CDATA[ 
    !window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
    // ]]> 
    </script>

    <!-- Username [BBCode] / (c) 4seven / 2011 -->
    <select id="hide_username" style="font-size:11px;" title="Username [BBCode]">
    <!-- BEGIN username_bb -->
    <option value="{username_bb.USERNAME_BB_VALUE}">{username_bb.USERNAME_BB_USER}</option>
    <!-- END username_bb -->
    </select>
    <input id="username_click" type="button" class="button2" onclick="username_copy();" value="Insert" />

    <script type="text/javascript">
    // <![CDATA[
    function username_copy(){
    var username_copy = '[username' + $('#hide_username').val() + ']'+ $('#hide_username option:selected').text() + '[/username]';
    document.forms['postform'].message.value += username_copy;
    document.forms['postform'].message.focus();
    return false;}
    // ]]>
    </script>
    <!-- Username [BBCode] / (c) 4seven / 2011 -->    

<!-- ENDIF -->


Quote:
make a bbcode

BBCode usage
Code:
[username|{COLOR}|{IDENTIFIER}|{NUMBER}]{TEXT}[/username]


HTML replacement
Code:
<a class="username-coloured" style="color:{COLOR};font-weight:{IDENTIFIER};" href="./memberlist.php?mode=viewprofile&amp;u={NUMBER}">{TEXT}</a


Help line
Code:
nothing


Display on posting page
Code:
no


clear all board- and browser-caches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
PostPosted: 28 Nov 2012, 20:58 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Update

If you want to insert the content always at caret position and not at the end of the text,

change

Code:
    <script type="text/javascript">
    // <![CDATA[
    function username_copy(){
    var username_copy = '[username' + $('#hide_username').val() + ']'+ $('#hide_username option:selected').text() + '[/username]';
    document.forms['postform'].message.value += username_copy;
    document.forms['postform'].message.focus();
    return false;}
    // ]]>
    </script>

to

Code:
    <script type="text/javascript">
    // <![CDATA[
    function username_copy()
        {
             insert_text('[username' + $('#hide_username').val() + ']'+ $('#hide_username option:selected').text() + '[/username]');
        }
    // ]]>
    </script>

clear all board- and browser-caches

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.067s | 23 Queries | GZIP : Off ]