*

Sudo

  • ***
  • 47 posts
New MOD
« on: October 29, 2017, 05:08:28 AM »
Hi,
I recently wrote a new MOD to display users credit balance in a flash message upon login to encourage users who have credit balances to spend $$$.  If anyone is interested, PM me and I can provide guidance.  Thought it was useful to get new users who were given credit to spend it up.  Works with plain login and hybrid auth plugin.

warm regards,
-Sudo

*

MB Themes

Re: New MOD
« Reply #1 on: October 29, 2017, 09:06:54 AM »
@Sudo
You can share steps here and we might integrate it to plugin...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Carlos Carcamo

  • ****
  • 105 posts
  • LaKompra.com
Re: New MOD
« Reply #2 on: October 31, 2017, 05:32:55 PM »
Hi,
I recently wrote a new MOD to display users credit balance in a flash message upon login to encourage users who have credit balances to spend $$$.  If anyone is interested, PM me and I can provide guidance.  Thought it was useful to get new users who were given credit to spend it up.  Works with plain login and hybrid auth plugin.

warm regards,
-Sudo

Bro could you please share the code to show this new mode, thanks in advance
LaKompra.com

*

Sudo

  • ***
  • 47 posts
Re: New MOD
« Reply #3 on: November 01, 2017, 02:20:39 AM »
Yes will post when I get a moment, have been tied up recently!!

*

Sudo

  • ***
  • 47 posts
Re: New MOD
« Reply #4 on: November 01, 2017, 02:31:59 AM »
MOD Steps:
- replace '--YOURSITE--' with your site info
- is very much hacked into code and I did not really use the built in path constructs in the code.


/oc-content/plugins/osclass_pay/functions.php
added function at the bottom, name: "osp_credits_flash" (Line 2817-2855)
Code: [Select]
// CREDITS REMINDER
// ZeroThree Media LLC
// Sudo - v.1.0 - 10/28/17
function osp_credits_flash(){

  if(osc_logged_user_id() != NULL){
      if(osp_param('wallet_enabled') == 1) {
       
        $wallet = osp_get_wallet(osc_logged_user_id());
        $credit = $wallet['formatted_amount'];
       
        $credit_display = '$'.number_format($credit,2);
           
        if($credit <> '' && $credit > 0) {
          //osc_add_flash_error_message(sprintf(__('You have %s in free credit, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item" target="_blank">Click here to Upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
         
          if($credit < 4){
            //$html = '<div id="flashmessage" class="flashmessage flashmessage-error"><a class="btn ico btn-mini ico-close">x</a>Credit balance low. <a href="http://--YOURSITE--/osclasspay/pack">Click to buy more</a></div>';
            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://onebackpage.com/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
          }else{
            //$html = '<div id="flashmessage" class="flashmessage flashmessage-error"><a class="btn ico btn-mini ico-close">x</a>You have '.$credit_display.' in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a></div>';
            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
          }
            //echo $html;
         
        }
      }
  }
}

    osc_add_hook("after_login", "osp_credits_flash");
    /*
if(osc_logged_user_id() != NULL){
    osc_run_hook("after_login", 'osp_credits_flash');
}
*/
// CREDITS REMINDER
// ZeroThree Media LLC
// Sudo - v.1.0 - 10/28/17

If using HybridAuth -
Oct25, 2017 - Display Credits Flash on Login
/oc-content/plugins/HybridAuth/HybridAuthClass.php
Line 55-75
Code: [Select]
                // *****************************************
                // ZeroThree Media LLC
                // Sudo - v.1.0 - 10/25/17
                // *****************************************
                if(osp_param('wallet_enabled') == 1) {
                   
                    $wallet = osp_get_wallet(osc_logged_user_id());
                    $credit = $wallet['formatted_amount'];
                   
                    $credit_display = '$'.number_format($credit,2);
                   
                    if($credit <> '' && $credit > 0) {           
                        if($credit < 4){
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }else{
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }                       
                    }
                }
                // *****************************************

« Last Edit: November 02, 2017, 11:02:07 AM by frosticek »

*

MB Themes

Re: New MOD
« Reply #5 on: November 01, 2017, 09:28:31 AM »
Thanks ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Carlos Carcamo

  • ****
  • 105 posts
  • LaKompra.com
Re: New MOD
« Reply #6 on: November 01, 2017, 12:05:39 PM »
Thank you man !!


My version in spanish

f
Code: [Select]
unction osp_credits_flash(){

  if(osc_logged_user_id() != NULL){
      if(osp_param('wallet_enabled') == 1) {
       
        $wallet = osp_get_wallet(osc_logged_user_id());
        $credit = $wallet['formatted_amount'];
       
        $credit_display = '$'.number_format($credit,2);
           
        if($credit <> '' && $credit > 0) {
          osc_add_flash_ok_message(sprintf(__('Tu saldo es de %s.', 'osclass_pay'), osp_format_price($credit)));
         
          if($credit < 1){
           
            osc_add_flash_ok_message(sprintf(__('Si deseas comprar mas credito has click <a href="http://lakompra.com/osclasspay/item">Aqui</a>', 'osclass_pay'), osp_format_price($credit)));
          }else{
           
            osc_add_flash_ok_message(sprintf(__('Destaca tus Anuncios en la sección de <a href="http://lakompra.us/osclasspay/item">Mis Anuncios Premium</a>', 'osclass_pay'), osp_format_price($credit)));
          }
            //echo $html;
         
        }
      }
  }
}

    osc_add_hook("after_login", "osp_credits_flash");
    /*
if(osc_logged_user_id() != NULL){
    osc_run_hook("after_login", 'osp_credits_flash');
}
*/

I just change this osc_add_flash_ok_message to be green
« Last Edit: November 01, 2017, 01:19:50 PM by Carlos Carcamo »
LaKompra.com

*

ferry

  • ****
  • 155 posts
Re: New MOD
« Reply #7 on: November 02, 2017, 07:53:29 AM »
I tried this at your site Carlos, but after 2 logins i was blocked. Good security :-)
But with facebook login i saw the message.

Then i tried at Sudo. I could not login with with Facebook, so i did with Twitter and the message was there.

Because i use madhouse facebook plugin and if i ad the code, the code wont dissapear, but multiply or even come triple sometimes.
Right after login with facebook the message is allright and shows just once.
But go to another page or search the message appears double.

So disabled this again because it started to be a little late, Will look further tommorrow.

Thanks for the mod Sudo!

Quote
// *****************************************
                // ZeroThree Media LLC
                // Sudo - v.1.0 - 10/25/17
                // *****************************************
                if(osp_param('wallet_enabled') == 1) {
                   
                    $wallet = osp_get_wallet(osc_logged_user_id());
                    $credit = $wallet['formatted_amount'];
                   
                    $credit_display = '$'.number_format($credit,2);
                   
                    if($credit <> '' && $credit > 0) {           
                        if($credit < 4){
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }else{
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }                       
                    }
                }
                // *****************************************
« Last Edit: November 02, 2017, 09:13:38 AM by ferry »

*

MB Themes

Re: New MOD
« Reply #8 on: November 02, 2017, 11:11:02 AM »
@Sudo
Integrated into plugin in simplified version, will be available in next update.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Carlos Carcamo

  • ****
  • 105 posts
  • LaKompra.com
Re: New MOD
« Reply #9 on: November 02, 2017, 02:54:29 PM »
I tried this at your site Carlos, but after 2 logins i was blocked. Good security :-)
But with facebook login i saw the message.

Then i tried at Sudo. I could not login with with Facebook, so i did with Twitter and the message was there.

Because i use madhouse facebook plugin and if i ad the code, the code wont dissapear, but multiply or even come triple sometimes.
Right after login with facebook the message is allright and shows just once.
But go to another page or search the message appears double.

So disabled this again because it started to be a little late, Will look further tommorrow.

Thanks for the mod Sudo!

Quote
// *****************************************
                // ZeroThree Media LLC
                // Sudo - v.1.0 - 10/25/17
                // *****************************************
                if(osp_param('wallet_enabled') == 1) {
                   
                    $wallet = osp_get_wallet(osc_logged_user_id());
                    $credit = $wallet['formatted_amount'];
                   
                    $credit_display = '$'.number_format($credit,2);
                   
                    if($credit <> '' && $credit > 0) {           
                        if($credit < 4){
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }else{
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }                       
                    }
                }
                // *****************************************


Thank you Ferry, in that case, my team blocks email from different countries hahaha

I see your email and domain :)

Im using facebook from madhouse also.
LaKompra.com

*

Sudo

  • ***
  • 47 posts
Re: New MOD
« Reply #10 on: November 02, 2017, 06:42:44 PM »
Yes, I do not use Madhouse for facebook login (I dont use facebook login at all), so was not tested with anything
but twitter and Google login using HybridAuth.

@Sudo

I tried this at your site Carlos, but after 2 logins i was blocked. Good security :-)
But with facebook login i saw the message.

Then i tried at Sudo. I could not login with with Facebook, so i did with Twitter and the message was there.

Because i use madhouse facebook plugin and if i ad the code, the code wont dissapear, but multiply or even come triple sometimes.
Right after login with facebook the message is allright and shows just once.
But go to another page or search the message appears double.

So disabled this again because it started to be a little late, Will look further tommorrow.

Thanks for the mod Sudo!

Quote
// *****************************************
                // ZeroThree Media LLC
                // Sudo - v.1.0 - 10/25/17
                // *****************************************
                if(osp_param('wallet_enabled') == 1) {
                   
                    $wallet = osp_get_wallet(osc_logged_user_id());
                    $credit = $wallet['formatted_amount'];
                   
                    $credit_display = '$'.number_format($credit,2);
                   
                    if($credit <> '' && $credit > 0) {           
                        if($credit < 4){
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }else{
                            osc_add_flash_error_message(sprintf(__('You have %s in credits, upgrade your listings...<a href="http://--YOURSITE--/osclasspay/item">Click here to create or upgrade your listing</a>', 'osclass_pay'), osp_format_price($credit)));
                        }                       
                    }
                }
                // *****************************************

*

ferry

  • ****
  • 155 posts
Re: New MOD
« Reply #11 on: November 02, 2017, 06:53:03 PM »
i solved it already

i had the code double  :)

Thanks

*

ferry

  • ****
  • 155 posts
Re: New MOD
« Reply #12 on: November 04, 2017, 07:44:34 AM »
The most users never logout.
So if they visit the website again they dont see the message.

I set cookies max time in php.ini to 3600 sec, but next day i visit again i am still logged.

What can be the fix, that at every new visit the message is visible