Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Oct 2000
Posts: 290
Member
Member
Offline
Joined: Oct 2000
Posts: 290
I have been trying to add another icon to the string with the ProfileString and EmailString area, and I have successfully added all the support code. I have a Control Panel area where I can enter the username and a number that corresponds with that user's scrapbook number. The data is entered in the control panel as pipe!!pipe and is written to a file. All that works. Each entry I make is added to a new line in the file and saved. I'm having a problem getting it called up right. Here is the code I use to call the variable ThisScrap:

Code
code:

If you please have a look you will notice that the 4th message has the blue folder for the scrapbook, and he is configured in the control panel. So that one worked. [Linked Image] But the following messages ALSO have the blue folder, they ARE NOT configured in the control panel, and the fly-over text belongs to message number 4. Currently, the above code is included in the same area where ThisTitle variable is assigned...but I have tried to place it in ubb_llibrary2.pl with the same results

Please check out the problem HERE!


------------------
Tony (Vipermad) Rickard
Viper Club UBB Admin

This message has been edited by Vipermad on January 06, 2001 at 09:29 AM

Sponsored Links
Joined: Feb 2000
Posts: 4,625
Member
Member
Offline
Joined: Feb 2000
Posts: 4,625
HI Viper! You'd probly get more help in the "Perl" forum.

------------------

Modification Developer of the Ultimate Bulletin Board
Due to time limitation, I do not offer support Via. E-mail, ICQ or AIM.
Regards,
MasterMind

Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Ah, here's your problem. THe script runs through the first few posts. It doesn't find the scrap book. THen on the forth post it does!

now $ThisScrap is defined. The next post. It Doesn't find the scrap book. BUT $ThisScrap still has the same data. So you'll either want an } else { or before the if statement put

$ThisScrap = '';

[Linked Image]

------------------
Powered by ZCom Bulletin Boards

Joined: Oct 2000
Posts: 290
Member
Member
Offline
Joined: Oct 2000
Posts: 290
THANK YOU Zanardi! That cleaned up THAT problem. Though I had to add $ThisScrap = ""; before the if statment to get it to work. It no longer displays errant scrapbooks like it did....now, it only displays the last entry in the list. If you go back to the page listed above, you'll see there is only one user with a blue folder. Well, ALL users have an entry in scraps-list.file The one showing is the most recent addition. Here is the new code I used:

---------------
# Check for Scrapbook
my @scrapbook = &OpenFile("$MembersPath/scrap-list.file");

foreach $thisline(@scrapbook) {
my @scraps = split(/|!!|/, $thisline);
chomp($scraps[1]);
$ThisScrap = "";
if ($thisprofile[0] eq "$scraps[0]") {
$ThisScrap = qq(
Check out $thisline[2]'s Prowler ScrapBook!!!
);
}
}
------------------

Thank you so very much, it was nice to make some progress...thanks to you! Personally, I think it is that IF statement that is wrong in some way..maybe an UNLESS would be better? So far, I am getting the variable assigned, and to the right person...but it isn't doing the whole list, which is why I think the IF statement is the problem.

------------------
Tony (Vipermad) Rickard
Viper Club UBB Admin

This message has been edited by Vipermad on January 06, 2001 at 09:38 AM

Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Hmm, im not really sure what you mean by they are configured in the control panel. Could you explain that a little be to me?

------------------
Powered by ZCom Bulletin Boards

Sponsored Links
Joined: Oct 2000
Posts: 290
Member
Member
Offline
Joined: Oct 2000
Posts: 290
OK here goes. Another hack gave me the idea as to how to accomplish what I want to do. I have a control panel area that lets me configure who is assigned a scrapbook. Basically, the scrapbooks are already in another part of the board, so all I wanted was to put a link (as I have) for each user who has a scrapbook. It is a up to me to configure a username for a scrapbook in the control panel. What I do is go into the control panel area I created, and I can insert a username and a corresponding scrapbook number. Not everyone has a scrapbook, so I needed to be able to assign a number based on manually entering the data for a username. The info is entered as |!!|, and it is here that the scrap-list file is created. This works...it works for the original hack (which is used by Admin only to assign a custom title, or custom titles based on post counts). Anyway, that part of the hack works as I have checked the members folder for the scrap-list.file and the proper entries. I did not want to add this to the profile, I only want it controlled by Admin.

So, I enter the data for a username, one per line, and it is written to the scrap-list.file (my little database), then it is called by the above bit of code and should give each configured user a blue folder with the proper scrapbook number.

Did any of that make sense?? [Linked Image]

For the original hack, written by Jimbo (make sure credit given where due), I enter a username in the format described above and the title I want. You notice that it works because all the titles on the page listed above are assigned by that hack. So I figured the same thing should happen with my little addition. Here is the whole sub-routine including what I added. This sub is called by ubb_library2.pl where $ThisStatus is assigned:

sub ParseUserTitles{
# Check for Post Count titles
my @posttitles = &OpenFile("$MembersPath/title-list2.file");

foreach $thisline(@posttitles) {
my @postnumtitles = split(/|!!|/, $thisline);
chomp($postnumtitles[1]);

if ($thisprofile[7] > $postnumtitles[0]) {
$ThisStatus = "$postnumtitles[1]";
}
}

# Check for Admin / Moderator Titles
if ($thisprofile[8] eq "Administrator") {
$ThisStatus = "$AdminTitle";
}
elsif ($thisprofile[8] eq "Moderator") {
$ThisStatus = "$ModeratorTitle";
}


# Check for Username Specific Titles
my @spectitles = &OpenFile("$MembersPath/title-list.file");

foreach $thisline(@spectitles) {
my @titles = split(/|!!|/, $thisline);
chomp($titles[1]);

if ($thisprofile[0] eq "$titles[0]") {
$ThisStatus = "$titles[1]";
}
}

# Check for Scrapbook
my @scrapbook = &OpenFile("$MembersPath/scrap-list.file");

foreach $thisline(@scrapbook) {
my @scraps = split(/|!!|/, $thisline);
chomp($scraps[1]);
$ThisScrap = "";
if ($thisprofile[0] eq "$scraps[0]") {
$ThisScrap = qq(
Check out $thisline[2]'s Prowler ScrapBook!!!
);
}
}
} # end smart title parsing routine

Zanardi, I am very happy to have your expertise, and I think you, more than I can put into words here, for your help

------------------
Tony (Vipermad) Rickard
Viper Club UBB Admin

Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Replace your foreach loop with this and tell me if it works:

LINE: for (@scrapbook) {
chomp($_);
my @scraps = split(/|!!|/,$_);
$ThisScrap = "";
if ($thisprofile[0] eq "$scraps[0]") {
$ThisScrap = qq(Check out $thisline[2]'s Prowler ScrapBook!!! );
last LINE;
}
}


------------------
Powered by ZCom Bulletin Boards

Joined: Oct 2000
Posts: 290
Member
Member
Offline
Joined: Oct 2000
Posts: 290
Zanardi, you are a STAR! Between the two of us, it works! I replaced the foreach as you said, but it did not work...so I had a closer look and realized this line was wrong:

my @scraps = split(/|!!|/,$_);

I replaced that one line with basically the same thing, only escaping each of the |!!| like this:

Code
code:

And it worked like a charm! I'm off to do further testing on it, but initial tests say it is a go! BTW, I looked at my original code and those escapes aren't there either, so I tried my original code with the escapes in place and it did not work (frown). Thank you very much for the PERL lesson...care to give a brief explanation here or by e-mail? Thanks again!!!

------------------
Tony (Vipermad) Rickard
Viper Club UBB Admin


This message has been edited by Vipermad on January 07, 2001 at 02:05 PM

Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
duh, I could've sworn I put those esacpes in there [Linked Image] But im glad to here it works

But I could not find anything wrong with your above code besides the fact it didn't do what you wanted to [Linked Image]

------------------
Powered by ZCom Bulletin Boards

Joined: Oct 2000
Posts: 290
Member
Member
Offline
Joined: Oct 2000
Posts: 290
Yeah, I am still testing the original coding to see what the heck is going on...but it works so I'm happy!! Kinda frustrating when you can look at something, know it should work, and it doesn't! Thanks again! I might call on your expertise in the future if thats OK!?!?!?!

------------------
Tony (Vipermad) Rickard
Viper Club UBB Admin

Sponsored Links
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Any time [Linked Image]

------------------
Powered by ZCom Bulletin Boards


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
Morgan 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 20240430)