vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   End-User Options - Secret Admirer / Crush System (https://vborg.vbsupport.ru/showthread.php?t=61632)

carolmyt 01-24-2005 10:09 PM

Well, mine installed just fine, with just one strange problem: the first time you click to send admiration, you get the duplicate phrase. I've double checked the code, and its all correct. Any ideas why this is happening?

You know, I think I may know what the problem is: I missed "NOTE: You must replace TABLE_PREFIX with the prefix that you use on your VB3
installation... OR remove it if you are not using a table_prefix." So . . . can somebody explain that to me? I'm new to the SQL queries. How do I know if I'm using a table prefix, and if I am, what it is?

buro9 01-25-2005 05:00 AM

Quote:

Originally Posted by carolmyt
Well, mine installed just fine, with just one strange problem: the first time you click to send admiration, you get the duplicate phrase. I've double checked the code, and its all correct. Any ideas why this is happening?

You know, I think I may know what the problem is: I missed "NOTE: You must replace TABLE_PREFIX with the prefix that you use on your VB3
installation... OR remove it if you are not using a table_prefix." So . . . can somebody explain that to me? I'm new to the SQL queries. How do I know if I'm using a table prefix, and if I am, what it is?

Good good, just got the email notification and thought... nope... not installed correctly.

The hack cunningly uses MySql trickery to detect duplicates... the trickery is that when two identical rows get inserted it causes an error. I detect the error and that's how I know that an admiration already exists.

However, it means I am basically masking MySql errors.

Anyhow... table prefix.

In your /includes/config.php file there is a bit that looks like this:
Code:

// Prefix that your vBulletin tables have in the database.
// For example: $tableprefix = 'vb3_';
$tableprefix = 'vb3_';

Now, in my instructions I ask you to do this:
Code:

DATABASE WORK

In phpMyAdmin or from the MySql command line, run the applicable piece of SQL.
NOTE: You must replace TABLE_PREFIX with the prefix that you use on your VB3
installation... OR remove it if you are not using a table_prefix.

FOR A FRESH INSTALL:

  CREATE TABLE TABLE_PREFIXsecretadmirer (
    userid INT(10) NOT NULL,
    admiresuserid INT(10) NOT NULL,
    datecreated INT(10) NOT NULL,
    PRIMARY KEY (userid, admiresuserid),
    KEY admiresuserid_ix (admiresuserid),
    KEY userid_ix (userid)
  ) TYPE = MYISAM;

FOR AN UPGRADE FROM A VB2 VERSION:

RENAME TABLE secret_admirer TO TABLE_PREFIXsecretadmirer;

Because you are a new install you are doing the CREATE TABLE bit.

Now, in that CREATE TABLE bit the first line says:
Code:

  CREATE TABLE TABLE_PREFIXsecretadmirer (
If your $tableprefix in your config.php file was blank (''), then that should be:
Code:

  CREATE TABLE secretadmirer (
If your $tableprefix in your config.php file contained vb3_ ('vb3_'), then that should be:
Code:

  CREATE TABLE vb3_secretadmirer (
So whatever your table prefix is... adjust the name of the database table to be created accordingly.

You only need to do this once, in that piece of SQL. The script can work it out when running, but because I didn't build an installer, I couldn't work out whether you have a table prefix.

Oh, and you will also want to run this which will delete the table that you made by accident:
Code:

  DROP TABLE TABLE_PREFIXsecretadmirer;
:)

Hope that all makes sense to you :)

carolmyt 01-25-2005 10:45 PM

Perfectly clear, and now running perfectly! Many thanks!

docvader 01-25-2005 10:56 PM

Buro, I've looked in my phpadmin, and found a table called "TABLE_PREFIXsecretadmirer". Now, I have no table prefixes in my config file, so I'm not sure how this got created. And, the hack is working fine.

Suggestions???

buro9 02-02-2005 01:20 PM

Quote:

Originally Posted by docvader
Buro, I've looked in my phpadmin, and found a table called "TABLE_PREFIXsecretadmirer". Now, I have no table prefixes in my config file, so I'm not sure how this got created. And, the hack is working fine.

Suggestions???

See two posts above.

You must've run the SQL and then modified it to remove the TABLE_PREFIX bit and then ran it again. So just deleted the unused table :)

carolmyt 02-04-2005 02:54 PM

Would it be possible to make this feature accessible from the user's postbit? So if you wanted to register admiration, you wouldn't have to go to the profile.

Wifey 02-10-2005 02:49 AM

Okay here's my problem.

No longer have the blank page problem - for some reason when I FTPed the file it didn't come up with the entire code. Who knows.

Anyhow, the PM's aren't sending like they're supposed to and neither are the e-mails.

Any idea?

buro9 02-10-2005 06:53 AM

Quote:

Originally Posted by ashkarita
Okay here's my problem.

No longer have the blank page problem - for some reason when I FTPed the file it didn't come up with the entire code. Who knows.

Anyhow, the PM's aren't sending like they're supposed to and neither are the e-mails.

Any idea?

Check the install guide again and verify that you did everything.

Note these bits:
Code:

PHRASE WORK:

Under the phrase type: Front-End Redirect Messages

Add these phrases:

secretadmirer_acknowledged
  Your admiration for that user has been successfully registered.

secretadmirer_duplicate
  You've already registered your admiration for that user.<br/> Maybe it's time to PM them and let them know you like them?

secretadmirer_report_sent
  Your secret admirer report has been dispatched to your registered e-mail address.

secretadmirer_limit
  Sorry! You may only admire a maximum of 5 people within the last month.


buro9 02-10-2005 06:54 AM

Quote:

Originally Posted by ashkarita
Okay here's my problem.

No longer have the blank page problem - for some reason when I FTPed the file it didn't come up with the entire code. Who knows.

Anyhow, the PM's aren't sending like they're supposed to and neither are the e-mails.

Any idea?

Ooops. I replied above to the other problem ;)

Check that you created the templates:
Code:

TEMPLATE WORK

For each of the text files, you need to add it as a template of the same name.
Change the values within them to match your forum and personal preference :)
There are five in total:

  secret_admirer_alert_email
  secret_admirer_alert_pm
  secret_admirer_match_email
  secret_admirer_match_pm
  secret_admirer_report_email

The text files are in the install Zip file.

buro9 02-10-2005 06:55 AM

Quote:

Originally Posted by carolmyt
Would it be possible to make this feature accessible from the user's postbit? So if you wanted to register admiration, you wouldn't have to go to the profile.

Yup, you just need to add the link:
Code:

<a href="profile.php?$session[sessionurl]do=admire&amp;userid=$userinfo[userid]">Register your admiration for $userinfo[username]</a>
You may need to check and change the $userinfo array name to match that of the post... but effectively you should add the above link to the relevant part of the postbit or postbit_legacy templates.

Urban51 02-13-2005 10:14 PM

Installed and working perfectly....thanks a bunch....

CrazyLady 03-27-2005 01:59 PM

I like this idea and it would work perfectly on my board... is it Version 3.0.7 friendly?

I have a little concern though... spam. A lot of my members have chosen not to receive email from other members, and we don't send out any emails from the administrators... my concern is that people would now start to receive emails from the site they don't want. Plus, we have members that don't post, so I don't want them to be caught up in this when they are not interested.

My ideas, if I may be so bold, would be to add that user must have a minimum of X number of posts before they can admire someone or receive admiration from someone and second to only receive emails if they have "receive emails from other members" enabled, otherwise the admirations are just sent to their report when they are ready to view.

just a couple thoughts... but great idea! hope I can add it to my board soon!

buro9 03-27-2005 02:13 PM

Quote:

Originally Posted by CrazyLady
I like this idea and it would work perfectly on my board... is it Version 3.0.7 friendly?

I have a little concern though... spam. A lot of my members have chosen not to receive email from other members, and we don't send out any emails from the administrators... my concern is that people would now start to receive emails from the site they don't want. Plus, we have members that don't post, so I don't want them to be caught up in this when they are not interested.

My ideas, if I may be so bold, would be to add that user must have a minimum of X number of posts before they can admire someone or receive admiration from someone and second to only receive emails if they have "receive emails from other members" enabled, otherwise the admirations are just sent to their report when they are ready to view.

just a couple thoughts... but great idea! hope I can add it to my board soon!

It is 3.0.7 friendly... it's mostly self-contained with only one new block needing to be added to the existing code to call the self-contained stuff.

As for the no email thing... take a look through the code and comment that bit out, you'll find it's quit simple :)

And you can also do the minimum posts thing... when you add the link to the member info page, just put a conditional around it to check that the post qty for that user is above whatever value you want to use :)

CrazyLady 03-29-2005 04:15 PM

just a shot in the dark here, but in the "functions_secretadmirer.php" could I replace this
Code:

  //
  // Send an email if we couldn't send a PM
  //
  if (!($notifyUser['options'] & $_USEROPTIONS['receivepm'])) {
    //
    // Get the Email message
    //

with this?
Code:

  //
  // Send an email if we couldn't send a PM
  //
  if (!($notifyUser['options'] & $_USEROPTIONS['receivepm'] & $vboptions['showemail'] & $vboptions['adminemail'])) {
    //
    // Get the Email message
    //

all new to this stuff, but my attempt here is to check if the user has enabled both "Receive Email from Administrators" and "receive emails from other members". if not, no email is sent.

am I close? :ermm:

buro9 03-29-2005 09:24 PM

Quote:

Originally Posted by CrazyLady
just a shot in the dark here, but in the "functions_secretadmirer.php" could I replace this
Code:

  //
  // Send an email if we couldn't send a PM
  //
  if (!($notifyUser['options'] & $_USEROPTIONS['receivepm'])) {
    //
    // Get the Email message
    //

with this?
Code:

  //
  // Send an email if we couldn't send a PM
  //
  if (!($notifyUser['options'] & $_USEROPTIONS['receivepm'] & $vboptions['showemail'] & $vboptions['adminemail'])) {
    //
    // Get the Email message
    //

all new to this stuff, but my attempt here is to check if the user has enabled both "Receive Email from Administrators" and "receive emails from other members". if not, no email is sent.

am I close? :ermm:

Nice try but that wouldn't work.

There are two bitflag fields that contain the bits that indicate whether a user allows emails on those two criteria.

Those values are defined in includes/init.php

Namely they are these rows in the $_USEROPTIONS array:
'adminemail' => 16,
'showemail' => 256,

And the sum of the bits is the bitflag in $notifyUser['options'].

You would perform the logic roughly like this, but beware, the & is not doing what you think it is... you might want to look at the PHP manual regarding bitwise operators.

Code:

  //
  // Send an email if we couldn't send a PM
  //
  if (!($notifyUser['options'] & $_USEROPTIONS['receivepm']) &&
      ($notifyUser['options'] & $_USEROPTIONS['showemail']) &&
      ($notifyUser['options'] & $_USEROPTIONS['adminemail'])) {
    //
    // Get the Email message
    //

Which basically checks that they cannot already receive PM's, but that they ARE able to receive emails from both other users and admins.

Bitwise operators can be daunting when you first encounter them, so let me show you very quickly how they work.

Basically you take numbers that are of the power of 2.

1
2
4
8
16
32

If we presumed that they represented letters of the alphabet:

1 = A
2 = B
4 = C
8 = D
16 = E
32 = F

Then we could build a value that encapsulated which of those letters we wanted to store.

Example, we want to store options A and C... so it's 1 + 5 = 6.
To store A, D, F it is 1 + 8 +32 = 41.

Given any number you simply subtract the largest value you can to determine your options:
41 - 32 (F) = 9
9 - 8 (D) = 1
1 - 1 (A) = 0

So we know that 41 included the values for F, D and A.

The options field basically stores a bitflag number like that, and the plain & in the logic is not the same as &&, but is a bitwise operator that indicates whether the bitflag contains the desired bits.

So the example above should do it for you :)

CrazyLady 03-30-2005 12:17 AM

I would say you know what you are doing... this is WAY out of my league!!! I am far from knowing anything about php, let alone hacking it... I just came up with that change by looking at other code in vb, which I am still very new to as well.... but if you say your change will work? thanks very much! love it! always want to avoid those unwanted emails for my members anyway I can...

thank you

osariase 03-31-2005 10:39 PM

Can anyone who has installed this hack successfully please help me with the DATABASE WORK i do not understand this part below help please

DATABASE WORK

In phpMyAdmin or from the MySql command line, run the applicable piece of SQL.
NOTE: You must replace TABLE_PREFIX with the prefix that you use on your VB3
installation... OR remove it if you are not using a table_prefix.

FOR A FRESH INSTALL:

CREATE TABLE TABLE_PREFIXsecretadmirer (
userid INT(10) NOT NULL,
admiresuserid INT(10) NOT NULL,
datecreated INT(10) NOT NULL,
PRIMARY KEY (userid, admiresuserid),
KEY admiresuserid_ix (admiresuserid),
KEY userid_ix (userid)
) TYPE = MYISAM;

buro9 04-01-2005 03:52 AM

Quote:

Originally Posted by osariase
Can anyone who has installed this hack successfully please help me with the DATABASE WORK i do not understand this part below help please

DATABASE WORK

In phpMyAdmin or from the MySql command line, run the applicable piece of SQL.
NOTE: You must replace TABLE_PREFIX with the prefix that you use on your VB3
installation... OR remove it if you are not using a table_prefix.

FOR A FRESH INSTALL:

CREATE TABLE TABLE_PREFIXsecretadmirer (
userid INT(10) NOT NULL,
admiresuserid INT(10) NOT NULL,
datecreated INT(10) NOT NULL,
PRIMARY KEY (userid, admiresuserid),
KEY admiresuserid_ix (admiresuserid),
KEY userid_ix (userid)
) TYPE = MYISAM;

Simple.

In your ./includes/config.php file you have a setting named $table_prefix.

In the first line of this query is this line:
CREATE TABLE TABLE_PREFIXsecretadmirer (

If your table prefix setting = "vb3_" then you should change that line to:
CREATE TABLE vb3_secretadmirer (

If your table prefix setting = "forum_" then you should change that line to:
CREATE TABLE forum_secretadmirer (

If your table prefix is blank or empty then you should change that line to:
CREATE TABLE secretadmirer (

Once your have made that change then you should run that SQL query in a program like PhpMySql and it will create the table for you :)

Devient 04-01-2005 08:31 AM

i seem to be getting a blank page when click on the admiration link on the profile, i have done everything except this section - i really couldnt understand it:

PHRASE WORK:

Under the phrase type: Front-End Redirect Messages

Add these phrases:

secretadmirer_acknowledged
Your admiration for that user has been successfully registered.

secretadmirer_duplicate
You've already registered your admiration for that user.<br/> Maybe it's time to PM them and let them know you like them?

secretadmirer_report_sent
Your secret admirer report has been dispatched to your registered e-mail address.

secretadmirer_limit
Sorry! You may only admire a maximum of 5 people within the last month.

-- where on earth do you add this?

vb version: 3.07

any help would be greatly appreciated

buro9 04-01-2005 08:46 AM

In your admin control panel, in the left hand menu:

AdminCP > Languages & Phrases > Phrase Manager

And then at the bottom of the page there is an "Add New Phrase" button.

When you add a phrase it asks you three things:
Which group to put them in: The answer = Front-End Redirect Messages
What the phrase name is: These are the lines like: secretadmirer_acknowledged
What the phrase text is: These are the lines like: Your admiration for that user has been successfully registered.

You need to insert each phrase.

I need to build an installer ;)

osariase 04-01-2005 09:55 PM

Could you please help me Buro9 when i install I get the error message below

Warning: main(./includes/functions_secretadmirer.php): failed to open stream: No such file or directory in /profile.php on line 2619

Fatal error: main(): Failed opening required './includes/functions_secretadmirer.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/naijawor/public_html/profile.php on line 2619



and my Usercp page is broken on the left side of it which is the menus or items borders is broken.

Please help thanks

osariase 04-05-2005 03:59 PM

I just installed the secret admirer hack. Now I was able to get it to work but when you go to user cp the link it is displaced the table is all messed and the secret admirer report link is outside the from where other links are also, the private message folder inbox is supposed to be at the top not below where it is now. You can see a what i'm talking about using the link below

http://www.naijaworld.com/cpimage.jpg

can someone tell me how to correct this please

I will truely appreciate it thanks

buro9 04-05-2005 09:24 PM

osariase, if you can uninstall and wait until mid next week I will create an installer.

If you can't wait, then I think you either put the addition outside of your HTML table or did not close one of the tags.

Have you already hacked the UserCP template in any way? Even with an installer these bits you would have to do by hand.

You can email me a copy of that template if you wish and I will adjust it for you: david (at) buro9 (dot) com

osariase 04-06-2005 03:50 PM

Thanks Buro9
I will wait I love this hack too much to have it half and half. How do I know when you have an installer? do I send you an email to ask or u will post it?

let me know please thanks man for your efforts

buro9 04-06-2005 05:18 PM

When I've built the installer I will send an update to those who have marked themselves as having installed this hack.

That means you get an email or PM from this site advising you :)

osariase 04-13-2005 02:47 PM

Hi Buro9,
I finally got your hack working and its a beautiful hack I must say, kudos to you man. I want to thank you very much for your help, and if there are any additions to this hack please I would like to know about it thanks man

good job!!

buro9 04-14-2005 08:51 AM

Quote:

Originally Posted by osariase
Hi Buro9,
I finally got your hack working and its a beautiful hack I must say, kudos to you man. I want to thank you very much for your help, and if there are any additions to this hack please I would like to know about it thanks man

good job!!

I'm glad you got it working... I managed to corrupt my main hard drive and am currently without a computer at home on which to build an installer... so that is now delayed until I get my computer working again.

I think I will mkae some updates... additions to the admincp for the options.

It may be a while though... need a computer first ;)

lebanon 04-18-2005 02:39 PM

Hello ,
I dont seem to find what i have done wrong, the process seems easy
YET i got , Parse error: parse error, unexpected T_VARIABLE, expecting '(' in /home/personal/public_html/forum/profile.php on line 2268

This is ofcourse when i click on mydomain.xx/forum/profile.php?do=admire&userid=391
The same link that is added on users profile page.
Any ideas what could be wrong ?
edit : this is the line 2268
$optionselected["$categoryid"] = HTML_SELECTED;
Doesnt seem anywrong !

buro9 04-18-2005 03:00 PM

Double check the code that you changed in Profile.php.

The line number indicates it was the second change, which was an addition.

Using an old version of profile.php (you had a backup right, or you still have the vBulletin originals?), compare that and your modified version.

You have done one of two things, either:
1) Removed some existing code when you pasted in the new code.
or
2) When you pasted in the new code you only pasted part of it

So just check that the // HACK blocks indicate the start and end of the hack, and that you didn't remove any existing code when you added it.

buro9 04-18-2005 03:04 PM

The line of code you quoted is in my file around the 1500 mark, you must have another large hack installed to make that line number around the 2200 mark.

Please check against the original profile.php file or a backup that you know to be working that you have added the hack in the right place and not touched other code around it :)

lebanon 04-18-2005 03:12 PM

Yes i have large hacks and edits onto my profile pages, anyway i have a backup 3 days ago on my server i just started copying it and i will extract it to get the backup of profile.php
i will update you when this is done :) Thanks for the suggestion.

lebanon 04-18-2005 03:31 PM

I just restored an old profile.php and i also got the same problem when i clicked on the link again.

buro9 04-18-2005 07:14 PM

Quote:

Originally Posted by lebanon
I just restored an old profile.php and i also got the same problem when i clicked on the link again.

If you send me the file via email (pre-hack) I will edit it for you :)

Or send me the file as it currently is, and I shall fix the error :)

My email: david at buro9 . co m

lebanon 04-19-2005 10:37 AM

Hi ,
I just want to let you know that seems the problem is NOT from your hack, thus i apologize !
Because i tried at the mentioned line :
$optionselected["$categoryid"] = HTML_SELECTED; ( line 2268)
and btw line 2267 to me was : LIST
Anyway i just marked a # on that line to see what effect on your hack and your hack worked fine !
The problem seems older than it is and i will re-download a clean profile.php and compare from the vbulletin.com member site.
Anyway thanks for the great hack, am clicking install right now, and i will be checking up my code to see what is exactly wrong with that line ( unfortunatly i dont see whats wrong in it right now ! )

buro9 04-19-2005 07:37 PM

Quote:

Originally Posted by lebanon
Hi ,
I just want to let you know that seems the problem is NOT from your hack, thus i apologize !
Because i tried at the mentioned line :
$optionselected["$categoryid"] = HTML_SELECTED; ( line 2268)
and btw line 2267 to me was : LIST
Anyway i just marked a # on that line to see what effect on your hack and your hack worked fine !
The problem seems older than it is and i will re-download a clean profile.php and compare from the vbulletin.com member site.
Anyway thanks for the great hack, am clicking install right now, and i will be checking up my code to see what is exactly wrong with that line ( unfortunatly i dont see whats wrong in it right now ! )

Fantastic, and thanks for the feedback.

It's problems that are reported and then appear to be unsolved that put people off installing, so it's very appreciated :)

T3MEDIA 04-20-2005 11:30 AM

Question is the Usergroup defineable? WHY?

well I would use this so members with less access could contact my paid members. Since they cant post to them

this does seem cool AT first I thought it took all the info a user puts in its profile and searches for a member of their choice (male male female male what ever)

and brings back the closest match.

NOW who ever does that gets some paypal from me!

lebanon 04-20-2005 12:04 PM

Hi again,
I think i owe u the solution i downloaded the code into my local pc and in the phpeditor i noticed there was a space breaking the code into two lines ( like <br> )
The line wasnt wrong, except that when am editing it online it was actually being pasted like co<br>de :D

paul41598 07-08-2005 05:12 PM

you shouldnt be able to admire yourself, that kinda sux

Marco van Herwaarden 07-08-2005 09:07 PM

Quote:

Originally Posted by paul41598
you shouldnt be able to admire yourself, that kinda sux

Lol Paul, it tells a lot about you that you even tried. :D

paul41598 07-09-2005 04:03 AM

Quote:

Originally Posted by MarcoH64
Lol Paul, it tells a lot about you that you even tried. :D

I beta test out all hacks, to the extreme, just to assure theres no bugs laying around. :p


All times are GMT. The time now is 08:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01412 seconds
  • Memory Usage 1,890KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete