
BuffaloWeb
User
Apr 16, 2006, 10:06 AM
Post #3 of 4
(6914 views)
Shortcut
|
|
Re: [ross] Allow Featured Listing for certain users
[In reply to]
|
Can't Post
|
|
Hey Ross, What I ended up doing was duplicating signup.cgi/signup.ini/_signup.html (creating signup2.cgi/signup2.ini/_signup2.html). If the user signs up as a regular user, PayPal returns them to signup.cgi, if they signup for "Featured" status, PayPal returns them to signup2.cgi. signup.cgi works as it regularly would, but if they get sent to signup2.cgi, the script appends a "*" to the end of their name I had to use the name variable, since that is the only variable that can be manipulated in _signup2.html, and is accessible in search strings (that I could tell anyhow). I then use search strings to display only the listings marked "Yes" for featured AND have a user's name with a "*" in it. So, even if a "regular" user selects Yes for the Featured field, they will not get their listing displayed in the featured listings section since their name does not contain a "*" - pretty cool, eh? Here's what to do (in case anyone else needs this): 1. Duplicate signup.cgi/signup.ini/_signup.html and save the copies as signup2.cgi/signup2.ini/_signup2.html. 2. Open signup2.cgi and change all occurences of signup.ini and _signup.html to signup2.ini and _signup2.html respectively. 3. Modify signup2.ini to suit any other needs for the "featured" users (eg, you could also use this method to allow signup.ini users to have 1 listing, signup2.ini to have 5 listings, etc... - create as many as you need!) 4. Modify _signup2.html... In the <head> section (you may need to create one, I forget...), add: <script language="javascript"> var name = ""; var featured = "*"; function InitSaveVariables(form) { name = form.name.value.replace(/[*]/g,""); name = name+featured; } function NameHomepage(form) { InitSaveVariables(form); form.name.value = name; } </script> This first strips out any "*" that the user may have used (eg, trying to trick the system!), and then appends "*" to their name (eg, Roger Smith*). Modify your submit button to be: <input type="submit" name="save_user" value="Create Account" onclick="javascript:NameHomepage(this.form);"> (You can modify value="Create Account" to read whatever you want, but NOTHING ELSE. 5. Setup your signup form (a separate html page with your signup form) with the correct PayPal action/parameters, and make sure that the form contains: <input type="hidden" name="return" value="http://www.yourdomain.com/cgi-bin/listman/exec/signup.cgi"> for regular signups, or: <input type="hidden" name="return" value="http://www.yourdomain.com/cgi-bin/listman/exec/signup2.cgi"> for "featured" signups 6. In your home page use this to include featured listings: <!--#include virtual="/cgi-bin/listman/exec/search.cgi?search=1&perpage=6&lfield25_keyword=Yes&user_keyword=*&template=_search_results_featured.html" --> Note that I am using Featured listings on my home page, and am using an include to do it. The important thing is that wherever/however you intend to display featured listings, you simply add "&lfield25_keyword=Yes&user_keyword=*" to qualify those listings that are set by the user to be featured, AND qualify the search to only return listings from USERS that have the "*". That's it! So no when a user signs up for the "featured" services, PayPal sends them to signup2.cgi, which in turn appends a "*" to their name, which then allows their featured="Yes" listings to be displayed by including "&lfield25_keyword=Yes&user_keyword=*" in the search string... Hope someone finds it useful!
|