[UberCMS] Tag Add On

JayC

Always Learning
Aug 8, 2013
5,497
1,398
Working Tag Add-On :) Here you go:

How to add:
- Make a new boxtag.tpl file
- Copy and paste this into your tpl file
- Go to your me.php
- Find the center column (under the main me page part)
- Put $tpl->AddGeneric('tagbox');
Code:
<?php
$user = dbquery("SELECT * FROM users WHERE id = '" . USER_ID . "'");
$userAccount = mysql_fetch_assoc($user);
?>
<div class="habblet-container ">      
    <div class="cbb clearfix pixellightblue ">
    <h2 class="title">Add Tags!</h2>
    <div class="box-content">
  
    <?php
  if(isset($_POST['tag']))
{
  $tag = filter($_POST['tag']);

    if(strlen($tag) < 1 || strlen($tag) > 10)
    {
  echo '<center><div class="rounded rounded-red"><strong>The Tag must be between 1 - 10 characters.</strong></div></center>';
  }else
  {
  dbquery("INSERT INTO user_tags (user_id,tag) VALUES ('".USER_ID."','".$tag."')");
  echo '<center><div class="rounded rounded-green"><strong>Tag Added!</strong></div></center>';
    }
        }
    ?>
  
    <div style="text-align: left;">
    <div style="padding:5px"><center>
        <form name="form" action="" method="post">
    <span title="tag">Enter Tag: </span><br />
    <input type="text" name="tag" /><br /><br />
            <input type="submit" value="Add Tag" class="submit"></center>
        </form>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
</div>
</div>
</div></div>
</div>

Small little add on for ubercms, this is what it looks like:
7evP2JR.png


Tag Too Long or short:
RbPYW3X.png

Successfully Added:
zeQFWcp.png
 

JayC

Always Learning
Aug 8, 2013
5,497
1,398
oops use this code instead:

Code:
<?php
$user = dbquery("SELECT * FROM users WHERE id = '" . USER_ID . "'");
$userAccount = mysql_fetch_assoc($user);
?>
<div class="habblet-container ">       
    <div class="cbb clearfix pixellightblue ">
    <h2 class="title">Add Tags!</h2>
    <div class="box-content">
   
    <?php
  if(isset($_POST['tag']))
{
  $tag = filter($_POST['tag']);
    $exits = dbquery("SELECT null FROM user_tags WHERE tag='".$tag."' AND user_id ='".USER_ID."'");
  $exits2 = dbquery("SELECT null FROM user_tags WHERE user_id ='".USER_ID."'");
 
    if(strlen($tag) < 1 || strlen($tag) > 10)
    {
  echo '<center><div class="rounded rounded-red"><strong>The Tag must be between 1 - 10 characters.</strong></div></center>';
  }elseif (mysql_num_rows($exits2) > 8)
    {
  echo '<center><div class="rounded rounded-red"><strong>You have reached your max amount</strong></div></center>';
  }elseif (mysql_num_rows($exits) > 0)
    {
  echo '<center><div class="rounded rounded-red"><strong>You have that tag already!</strong></div></center>';
  }else
  {
  dbquery("INSERT INTO user_tags (user_id,tag) VALUES ('".USER_ID."','".$tag."')");
  echo '<center><div class="rounded rounded-green"><strong>Tag Added!</strong></div></center>';
    }
        }
    ?>
   
    <div style="text-align: left;">
    <div style="padding:5px"><center>
        <form name="form" action="" method="post">
    <span title="tag">Enter Tag: </span><br />
    <input type="text" name="tag" /><br /><br />
            <input type="submit" value="Add Tag" class="submit"></center>
        </form>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
</div>
</div>
</div></div>
</div>

Added: Can't have the same tag, Max tags: 8
 

Quit

Need help ? Inbox me!
Nov 29, 2013
94
10
Yes I did everything worked but when I create a tag it doesn't show on client or under usertags in my db
 

JayC

Always Learning
Aug 8, 2013
5,497
1,398
should be user_tags <- database name and you can't input characters like < > . ? !
 

Quit

Need help ? Inbox me!
Nov 29, 2013
94
10
DB:
Tag:
Client:

See the tags doesn't appear why is that? and how to fix
 

JayC

Always Learning
Aug 8, 2013
5,497
1,398
That's not my tag box, soo lol if you look at screenshots int hread thats not anything to fo with my thread
 

Quit

Need help ? Inbox me!
Nov 29, 2013
94
10
Sorry about that used the wrong tpl on me.page but ok the tag has been made now it doesn't show on client gameplay who to fix?
 

Users who are viewing this thread

Top