What is vldPersonals?

vldPersonals is a very easy to use dating/social software. It allows you to create a fully functioning & modern dating website in a matter of minutes. If You think it's too complicated - check vldPersonals!
Know more about how You can become a dating website owner

What is vldCrowd?

vldCrowd.com is the biggest unofficial community of vldPersonals owners. It is a place to share ideas and thoughts about Your dating website. It is a place to answer questions and receive answers.
Do You own a vldPersonals license? Don't hesitate and join!

Connect Today

Community members help each other to take their dating websites to the next level. Can You make your vldPersonals website better? Join and find out...

Connect With More Than 500 Dating Website Owners! Sign Up Today

How to: Zodiac works. Part 2

06/09/2009 03:12 AM
870 2 2
Ok, let's automate our star sign selection with the help of jQuery and for the sake of our users.
 
1. Add this function to your misc.js (it's location is /includes/js/)
 
Javascript

// calculate sun sign
function calc_sunsign()
{
       
        var month = $('#field_age_month').val();
                if ( ! month ) return;
       
        var day = $('#field_age_day').val();
                if ( ! day ) return;
       
 if ( month == 1 && day <=19) {sign = "Capricorn"; sign_id = "438";}
 else if (month == 1 && day >=20) {sign = "Aquarius"; sign_id = "439";}
 else if (month == 2 && day <=18) {sign = "Aquarius"; sign_id = "439";}
 else if (month == 2 && day >=19) {sign = "Pisces"; sign_id = "440";}
 else if (month == 3 && day <=20) {sign = "Pisces"; sign_id = "440";}
 else if (month == 3 && day >=21) {sign = "Aries"; sign_id = "441";}
 else if (month == 4 && day <=20) {sign = "Aries"; sign_id = "441";}
 else if (month == 4 && day >=21) {sign = "Taurus"; sign_id = "442";}
 else if (month == 5 && day <=20) {sign = "Taurus"; sign_id = "442";}
 else if (month == 5 && day >=21) {sign = "Gemini"; sign_id = "443";}
 else if (month == 6 && day <=20) {sign = "Gemini"; sign_id = "443";}
 else if (month == 6 && day >=21) {sign = "Cancer"; sign_id = "444";}
 else if (month == 7 && day <=21) {sign = "Cancer"; sign_id = "444";}
 else if (month == 7 && day >=22) {sign = "Leo"; sign_id = "445";}
 else if (month == 8 && day <=21) {sign = "Leo"; sign_id = "445";}
 else if (month == 8 && day >=22) {sign = "Virgo"; sign_id = "446";}
 else if (month == 9 && day <=21) {sign = "Virgo"; sign_id = "446";}
 else if (month == 9 && day >=22) {sign = "Libra"; sign_id = "447";}
 else if (month == 10 && day <=21) {sign = "Libra"; sign_id = "447";}
 else if (month == 10 && day >=22) {sign = "Scorpio"; sign_id = "448";}
 else if (month == 11 && day <=21) {sign = "Scorpio"; sign_id = "448";}
 else if (month == 11 && day >=22) {sign = "Sagittarius"; sign_id = "449";}
 else if (month == 12 && day <=20) {sign = "Sagittarius"; sign_id = "449";}
 else if (month == 12 && day >=21) {sign = "Capricorn"; sign_id = "438";}
 
 $('#field_zodiac').val(sign_id);
 
 return;
}
 

Put in place of my sign_ids your zodiac ids you can find them in between square brackets creating/editing custom field "Zodiac".

 
2. Open for editing your account_register.tpl and account_profile.tpl
 
Find word "birthday" after it you can see:
 
<select class="select" name="{field_label}_month">{dropdownlist:top.months,field_value_month}</select>
 
<select class="select" name="{field_label}_day">{dropdownlist:top.days,field_value_day}</select>
 
Modify <select ...> tags accordingly by adding:
id="field_{field_label}_month" onchange="calc_sunsign()"
and
id="field_{field_label}_day" onchange="calc_sunsign()"
 
Well now this code looks like that:
 
<select class="select" name="{field_label}_month" id="field_{field_label}_month" onchange="calc_sunsign()">{dropdownlist:top.months,field_value_month}</select>
<select class="select" name="{field_label}_day" id="field_{field_label}_day" onchange="calc_sunsign()">{dropdownlist:top.days,field_value_day}</select>
 
Every change of the month or day causes recalculating zodiac sign.
 
3. Press F5 button twice - refresh misc.js file in your browser. Visit registration page and profile data editing page, and try changing birthday.
 
4. Send mass private messages to existing users asking them set their Zodiac signs or fill Zodiac data yourself :)
 
Oops! You have more than one thousand users and don't want to spend the rest of your life filling zodiacs?
 
I have some solution I developed half an hour ago.
As dear vldCrowd member take it for free.
 
SQL

UPDATE `vld_members_data` SET data_zodiac = 'Capri_id' WHERE LEFT (RIGHT (data_age, 4), 2) = '01' AND RIGHT (data_age, 2) <= 19;
UPDATE `vld_members_data` SET data_zodiac = 'Aquarius_id' WHERE LEFT (RIGHT (data_age, 4), 2) = '01' AND RIGHT (data_age, 2) >= 20;
UPDATE `vld_members_data` SET data_zodiac = 'Aquarius_id' WHERE LEFT (RIGHT (data_age, 4), 2) = '02' AND RIGHT (data_age, 2) <= 18;
 

Capri_id is a place for you to put ID of the Capricorn you have at step 1.
 
Notice: I didn't complete the query list having short of time. Do you feel analogy with step 1? If you wish to help other vldCrowd members please complete query list and post it in comments then I'll update this post.
 
5. (optional) Run mentioned above SQL query.
 
SQL

...
UPDATE `vld_members_data` SET data_zodiac = '438' WHERE LEFT (RIGHT (data_age, 4), 2) = '01' AND RIGHT (data_age, 2) <= 19;
UPDATE `vld_members_data` SET data_zodiac = '439' WHERE LEFT (RIGHT (data_age, 4), 2) = '01' AND RIGHT (data_age, 2) >= 20;
UPDATE `vld_members_data` SET data_zodiac = '439' WHERE LEFT (RIGHT (data_age, 4), 2) = '02' AND RIGHT (data_age, 2) <= 18;
 

Dan, I hope you wouldn't mind if I use your screen shot about running queries in phpMyadmin.

 
6. Enjoy!

Comments

godyn

  • Posted on 09/24/2009 02:43 AM
Something else, related:
I managed this:
 
- a compatibility horoscope on the member pages (if they filled in their sign: Aquarius is compatble with Lion because,... and a long text why...
 
- an Iframe on the account home with a dalily horoscope I found. Only it's not a flirt horoscope.
So I'm looking to have this rss feed, but the signs horoscope seperate. that would be great, I could put it in a rss feed...
http://feeds.astrology.com/dailyflirt

person

  • Posted on 06/10/2009 12:29 PM
Ramil i want to thank you for your great tutorial.
:)

Log in to leave a comment