Favourites Create PDF Email Print

Update AUP referential user codes

Author:
elvar
Date added:
Friday, 04 September 2009
Last revised:
Saturday, 05 September 2009
Hits:
1528
Rating:
 
Vote for this:
Good - Bad
favoured:
0 Favour

Answer

If you want to update or change the default refferal names for ALL users you can easily update them in the backend of the MySQl database.

 

First go to the phpAdmin panel of your MySql database (some people do not know where it is - it is located in the CPanel of your site hosting).

Then create a backup of the existing REF columns with:

 

alter table `jos_alpha_userpoints_details` add refbck varchar(160)

alter table `jos_alpha_userpoints` add refbck varchar(160)

update `jos_alpha_userpoints` set refbck = referreid

update `jos_alpha_userpoints_details` set refbck = referreid

 

Now use following SQL's to simple update all REF column to YOUR naming:

update `jos_alpha_userpoints` a set a.`referreid` =
(select CONCAT('AUPRS-', u.username) from `jos_users` u where u.id = a.userid)
where a.`userid` in
(select `userid` from `jos_users`)

-- this will change the the previosuly random REF values to new way of naming

-- note that you can easily use your own code instead of the 'AUPRS-'. For example: 'Community-'

update `jos_alpha_userpoints` a, `jos_alpha_userpoints` a2
set a.`referraluser` = a2.`referreid`
where a.`referraluser` = a2.`refbck`

-- this SQL updates all old refferential users so you will still have old user refferals intact!

update `jos_alpha_userpoints_details` d set d.`referreid` =
(select a.`referreid` from `jos_alpha_userpoints` a where d.`referreid` = a.`refbck`)
where d.`referreid` in
(select `refbck` from `jos_alpha_userpoints`)

-- this SQL will finally update all users activities!

 

IF FOR ANY REASON you have problems running those SQL's or something went wrong please just use:

update `jos_alpha_userpoints` set referreid = refbck

update `jos_alpha_userpoints_details` set referreid = refbck

 

SQL's to restore OLD reffere values !

 

 

 

 

Category

Tags for this item

Goto Top