Previous Thread
Next Thread
Print Thread
Rate Thread
#230005 12/26/2002 7:38 AM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version - Custom Title 2.2
     ver 2.0 Updates to work with ver 6.2 and adds the ability to let only a specific user group change their titles.
     ver 2.1 Adds a check to make sure the user doesn't leave the title blank.
     ver 2.2 Fixes a bug where the title was getting lost on users who weren't part of the special user group. (Thanks to Leo at leoville.com for pointing out this bug. )

Description - Gives Users of a specific usergroup the ability to change their own titles.

Pre-requisites - none

Author - JoshPet - www.joshuapettit.com
     for discussions and bug reports come to www.ubbdev.com

Credits - WrAith created version 1.0. I updated for ver. 6.2, and Storm suggested the User Group restriction.

Files Altered - editbasic.php, changebasic.php, editbasic.tmpl, /languages/english/editbasic.php, /languages/english/changebasic.php

Database Altered - no

New Files - none

Any other info - The main Credits Goes to WrAith.


If you don't know the group ID Number...
you can run this SQL Query from the Admin Menu.

SELECT G_Id, G_Name
FROM w3t_Groups
Attachments
62534-CustomTitle2.2.txt (0 Bytes, 167 downloads)

Last edited by JoshPet; 12/30/2002 1:41 AM.
Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Updated the attachment to version 2.1

Version 2.1 adds a check to make sure the title isn't left blank.

If you've already installed version 2.0, here's how you can make the change:

code:

##
## In your modified changebasic.php file
##

#
# Find this:
#

// --------------------------------------------------
// If title is greater than 100 then we can't proceed
if ( strlen($Title) > 100 ) {
$html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat);
}


#
# Change to this:
#

// --------------------------------------------------
// If title is greater than 100 or blank then we can't proceed
if (( strlen($Title) > 100 ) || (!$Title)) {
$html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat);
}


##
## In the modified /languages/english/changebasic.php file
##

#
# Find this:
#

$ubbt_lang['TITLE_TOO_LONG'] = "Title too long.";



#
# Change to this:
#

$ubbt_lang['TITLE_TOO_LONG'] = "Your Title is either too long, or blank.";


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Ok - last update for a bit.

Just updated to version 2.2.

    ver 2.2 Fixes a bug where the title was getting lost on users who weren't part of the special user group. (Thanks to Leo at leoville.com for pointing out this bug.  )

code:

If you already installed, in your modified editbasic.php find this:

else {
$CustomTitle = "";
}


Change to this:

else {
$CustomTitle = "<input type ="hidden" name = "Title" value = "$UserTitle" />";
}


Joined: Jan 2002
Posts: 218
Enthusiast
Enthusiast
Offline
Joined: Jan 2002
Posts: 218
Hey, cool! I'm glad someone finally got around to doing this. Unfortunately, I don't have a copy of 6.2 so I couldn't do anything with it. Eventually when I get some cash I'll purchase the latest version.

Thanks for taking care of this.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
No prob. My users are loving it.... as are some users at Leoville.
I think Storm is using it as well.

Thanks for getting it started.

Sponsored Links
Joined: Aug 2002
Posts: 239
Member
Member
Joined: Aug 2002
Posts: 239
I was using it...... Gotta still add it to 6.2 so it'll work with the birthday hack.... Right now I'm choosing b-day until I get the energy to add it.......hehe Great hack though.....


Some people read their stars..... I choose to write my own
Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
I added the BDay hack to my 6.2 board and it works fine. I edited out the display for the year of birth, as some of my members are shy about their ages.

I'm now trying to add the Custom User Title hack, which uses some of the files I already hacked in the Birthday feature. I can't seem to get Custom Titles working properly.

-- at no point after I installed the hack did I ever see a "Custom Title" box in my profile. However, if I tried to submit other changes to my profile, I'd get a "We can't proceed; title too long or blank" error message.

-- I wasn't exactly clear on how to substitute the group number in editbasic.php. Am I to replace -5- with just 3 (for example), or do I replace it with -3- ?

-- in places where the BDay Hack and the Custom Title hack both affect the same area of code, which hack snippet goes first?

Thanks... hopefully it's nothing too complicated.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
First - list the group number like this -3- with the dashes. That's how it can tell 3 apart from 30.

As per areas that are affected by the two hacks....

Basically the

SELECT U_LoginName,U_Password,U_Email.......

line as well as the

list($LoginName,$ChosenPassword,$Email....

line

If those lines have already been modified from another hack... be sure to add the fields to the end of each line... rather than replacing the whole line.

so at the end of the SELECT line, you'll add: U_Groups and at the end of the list line, you'll add: $Groups. That way the Birthday fields and variables for the other mod remain intact.

Joined: Aug 2002
Posts: 111
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 111
I did it, it works! As always, you're a genius -- and you've been a genius twice today!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369


That made my day.

Sponsored Links
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
I have a quick question...

what if you want to allow multiple groups the ability to alter their titles? For example I have 4 different groups I'd like to allow custom titles for. But not sure how to make this happen

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I think this will do it:


if ((preg_match("/-5-/",$Groups)) || (preg_match("/-6-/",$Groups)) || (preg_match("/-7-/",$Groups))) {


I haven't tested... but the || means OR, so list them with the || between them.... then put a ( at the begining and another ) at the end.

Let me know if that works for you.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
This is more efficient:

if (strstr($Groups,'-5-') or strstr($Groups,'-6-') or strstr($Groups,'-7')) {

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks Eagle Eye!

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hmm, ok, I have a problem. Even before I added the multiple groups addition, everyone on the site is receiving this error when trying to update their profile:

[]Your Title is either too long, or blank. [/]

I thought adding the multiple groups thing would maybe eliminate this, but alas it did not. So as of right now, nobody can update their profile as it gives them that error. Any ideas?

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
hmm, I think it is your birthday hack conflicting with your custom title hack. I applied the title hack first, THEN the birthday hack... but then went back and looked and saw a lot of the group hack stuff has been overwritten by the birthday hack So no neither work *cry*

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Check the variables... and make sure that you did all the steps. It would seem that changebasic isn't getting the variable from edit basic.

If all that is fine try adding this near the other get input lines in the changebasic.php file:

$Title = get_input("Title","post");

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Add the stuff into the SELECT and list lines... don't copy and paste over those lines if you are doing more than one hack.... you have to add the Birtgday fields to the end of those lines....leaving the Title field in there as well.

If you overwrite the title field, and it's not in there being pulled from the DB then it is blank.

See my post above.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Thanks Josh, that was the problem. In the SELECT lines the title and groups variable was gone Everything seems well now

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
I just want to say thanks again. This hack has been by FAR the biggest revenue generator of all time! I announced that donating members receive the ability to make a custom title. Well, once people started seeing the fun titles were coming up with everyone was like "HEY! I want a custom title too!" So in the past few days, my paypal account has had over 200 dollars in donations!!!

I thought giving them 20 megs of photo storage was enough, but what they really wanted was the custom titles All I know is if this keeps up I will have the server completely paid for before spring

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That's good news!

Doah.... should have put that little bit of code in so that a few cents of each donation shuttles off to my paypal. LOL

Really.... that's good new. Yeah, donating members like the "perks" that you can give, specific to them.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hey Josh.. sorry to bring up an old thread, but I was trying to get this to work for 6.3.

And, it does... well, 99% of it does. The only problem is with users who do not have the ability to set custom title.. they can't edit their profiles anymore because they get the "Title is too long or empty" message



Not sure what in 6.3 would have changed to cause this.. but if you could take a look at it, that would be great

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
For them - you'll need to include the title on the form as a hidden field so it's not empty and doesn't get reset to blank.

If that's not enough direction, let me konw and I'll try to look at it specifically this evening.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hmm.. while I think I know how to add the field.. I have no idea how to make threads check the group to determine whether or not to make the field visible or hidden. That is a bit beyond me

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hmm.. I just got a PM from one of my users, and they "hacked" their title and they were not supposed to be. He said he was viewing the source, found a hidden textbox for the title... and he said he was able to go in and set a title

I looked, and he really did

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
This mod might be a little out of date.

If you are using the get_input function from post - then you shouldnt' be able to -

If there's no get input function and register globals is off (i think?) then you could easily add "title=whatever" to the url to changebasic.php

Check changebasic.php and make sure the get_input function is there.

This mod is probably due for a total rewite - it's been updated but probably isn't making best use of the functions.

I'll put this on my list of stuff to update - I'll need it eventually if I ever get around to upgrading measurection.

I've actually done it on 6.3 and am using it now at leoville.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hmm.. ok, there was no get_input for the title variable.. so I went ahead and added a line to do this with the rest of the get inputs. Unfortunately, that did not work.

Also, what I have noticed, is for the people who are able to change their titles, you can change it fine. But when you go back to your profile, the title box is blank, even though you do have a custom title.

I don't remember if this is how it worked in the past, but so far that and the inability for people to not change their profile w/o a custom title are the only two issues I see at this time

For now, I have just commented out this section:

Code
// -------------------------------------------------- <br />// If title is greater than 100 or blank then we can't proceed <br />   if (( strlen($Title) > 100 ) || (!$Title)) { <br />      $html -> not_right($ubbt_lang['TITLE_TOO_LONG'],$Cat); <br />   } <br />


And it at least allows users who can't set a title to update their profile, but the too long and blank checks are gone. So that is a temporary solution anyway

Last edited by Jeremy; 06/20/2003 10:00 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
For people without the ability to change the title - there should be the <input type="hidden"
for the title. I just checked these instructions and I see it in there.

Does your changebasic.php have this in it?
Code
<br />	else {<br />	 $CustomTitle = "<input type =\"hidden\" name = \"Title\" value = \"$UserTitle\" />";<br />	}<br />

That should pass the title from one script to another if they aren't allowed to change it.

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
That line is not in changebasic... but it is in editbasic, as per the instructions. And it does work correctly, as I created a test user who doesn't have title changing access, and the title field does not display, and is hidden. But even since it was hidden, it was still showing up as blank.

I think this has to do with why all title boxes are blank. Like I mentioned, I can set my own custom title, and it displays on the forum right. But as soon as I go back to edit my profile, the Title formbox is blank.. so it looks like the script isn't picking up the existing title and entering it into the box

Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hey Josh, I fixed the hack somehow (Not sure how since I'm a complete idiot when it comes to messing with code)

But anyway, there was a variable change I believe in 6.3.. from $UserTitle to just $Title. Also, in the editbasic script, it looked like the query was not pulling the title information, so by simply adding that to the query, and changing the $UserTitle to $Title, it seems to be working.

The titles now display in the textbox, only the proper users are allowed to edit their title, and users don't get the "too long or blank" message anymore

So updating your instructions shouldn't be too hard at all

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Great Thanks.

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
I am going to attempt this on 6.3 - if I manage to get it to work, I will note down what I do.

(unless Josh beats me to it )


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
I should have wrote down the steps I did to fix it.. but that would have meant I did something constructive

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
In that case, I will write down what I do to break it, and you can then suggest how I fix it


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)