Login or create new account.

By registering on joomprod.com, you will have immediate access to all our free products and to the public side of our support forum.

Enjoy our subscriptions.

Each of our subscriptions allow you to enjoy the private side of the support forum and all the update of our products for a period ranging from 3 months to 1 year.

Payment And immediate download.

After subscribing to one of our subscription, the products are immediately downloadable.

Login

Or Register
Accueil / forum / Support / VirtualMoney Support / Forbid two balance for one users

Support Availability Because we must sleep sometimes

Working days: Monday to Friday.
Reply time: Depending on the complexity of your support issue it's usually between a few hours to 48 hours.

Support is only guaranteed to paid subscribers

AdsManager - End of life

It is with great regrets that we have chosen to end the developpement of Adsmanager and its other associated components.

AdsManager is born 10 years ago and, as of today, the number of new subscriptions and downloads have fallen and we cannot maintain the component anymore.

All active subscribers will be able to continue enjoying support until the end of their subscription.

The components will be free and no support will be provided anymore for the other users.

×

Notice

The forum is in read only mode.

Forbid two balance for one users

More
9 years 10 months ago - 9 years 10 months ago #11675 by Vosem
Forbid two balance for one users was created by Vosem
Hello!
Sorry for my English and look at screenshots, please.

Components->Virtualmoney. Here we see list of users balance. In my example user www have a 1 000 000 credits.

Attachment vm1.jpg not found



everything is good.
Click to "New". And I can select user www again!

Attachment vm2.jpg not found



Enter the credits field (20 000 for example)

Attachment vm3.jpg not found



Click to "Save & Close" and now we have two balance for one user! On frontend, user www have balance equal 1 000 000.

Attachment vm4.jpg not found



Imho, it's not good

If I understand correctly, that's the code that should prevent such
/administrator/components/com_virtualmoney/helpers/users.php (start from 67 line)
        if(!$selected){
            $query = FOFQueryAbstract::getNew($db)
                ->select('vc.user_id')
                ->from("#__virtualmoney_credits as vc");
            $db->setQuery($query);
            $usersCredit = $db->loadResultArray();
 
            if(empty($usersCredit)){
                $listUsersCredit = '';
            } else {
                $listUsersCredit = ' WHERE u.id NOT IN ('.implode(',', $usersCredit).') ';
            }
 
            $sql = "SELECT u.id, u.name, u.username, u.email 
                    FROM #__users u 
                    ".$listUsersCredit."
                    ORDER BY ".$userDisplayType." ASC";
            $db->setQuery($sql);
            $users = $db->loadObjectList();
but
var_dump($usersCredit)
after
$usersCredit = $db->loadResultArray();
print NULL and select all Joomla users.

Thanks and Once again, sorry for the bad english
Attachments:
Last edit: 9 years 10 months ago by Vosem.
More
9 years 10 months ago #11692 by loic
Replied by loic on topic Forbid two balance for one users
Hello,

I will check that on my test site and I come back to you.

It seems a part of the code isn't working anymore.

Best regards.
More
9 years 10 months ago #11697 by loic
Replied by loic on topic Forbid two balance for one users
Hello,

On the code you have paste on your message, replace this part:
$query = FOFQueryAbstract::getNew($db)
                ->select('vc.user_id')
                ->from("#__virtualmoney_credits as vc");
            $db->setQuery($query);
            $usersCredit = $db->loadResultArray();
 
            if(empty($usersCredit)){
                $listUsersCredit = '';
            } else {
                $listUsersCredit = ' WHERE u.id NOT IN ('.implode(',', $usersCredit).') ';
            }

By this one:
$sql = "SELECT user_id
                    FROM #__virtualmoney_credits";
            $db->setQuery($sql);
            $usersCredit = $db->loadObjectList();
            $usersCreditArray = array();
            foreach($usersCredit as $userCredit) {
                $userCreditsArray[] = $userCredit->user_id;
            }
            if(empty($userCreditsArray)){
                $listUsersCredit = '';
            } else {
                $listUsersCredit = ' WHERE u.id NOT IN ('.implode(',', $userCreditsArray).') ';
            }

Best regards.
The following user(s) said Thank You: Vosem
Time to create page: 0.214 seconds
Powered by Kunena Forum