Jump to content

Jyoti Rani

Clients
  • Posts

    76
  • Joined

  • Last visited

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Posts posted by Jyoti Rani

  1. 2 hours ago, Marc Stridgen said:

    opentype was stating there that you should not have hard coded links in your theme there. If you are unsure if this is the case, you would need to contact your theme designer

    https://www.marketingcheckpoint.com/admin/ - in the admin section only font files are getting pointed to beta.marketingcheckpoint.com . All the other files are working fine

    Please suggest some solution.

  2. 1 hour ago, Jyoti Rani said:

    I have created some sub menu with custom code, But they are still pointing to old URL. for e.g. https://beta.marketingcheckpoint.com/mail/send/ this should be moved to https://www.marketingcheckpoint.com/mail/send/. Can you please suggest from where can I change this?

    URL issue has been resolved after clearing Cache. 

    Can any one please suggest solution for the Missing icons? You can view on the live site also. I have shared the link too

  3. 41 minutes ago, Randy Calvert said:

    You will need to move the files, edit your conf_global.php file, clear your system cache and most likely also fix your license.  But you don’t need to run the upgrader. The database would already be upgraded to the latest version. 🙂 

    Hi Randy,

    I have done the same process. But i am not able to see the icons on the site. 

    https://www.marketingcheckpoint.com/

    Please have a look.

  4. 18 hours ago, Marc Stridgen said:

    You have some downloads items there somewhere. You need to revert back to your backup, and remove that application, then continue

    Hello Marc,

    After the successful upgrade on the below URL. I am redirected to main url of the site rather than the url on which i have performed the upgrade. Can you please suggest something?

    For .e.g  When i click on Go to the Suite - I m redirected to https://www.marketingcheckpoint.com/ this url rather than https://beta.marketingcheckpoint.com/ and When i click on "Go to the AdminCP" i am redirected to https://www.marketingcheckpoint.com/admin this url rather than  https://beta.marketingcheckpoint.com/admin .

    Could contain: File, Webpage, Page, Text

  5. Just now, teraßyte said:

    Based on what you posted I now have a clearer idea of what you're doing, but I still see a few issues and optimizations that can be made:

    1. You can use a quick in_array() check for the group instead of multiple OR checks. Also, note that your code doesn't take into account secondary groups, if you want to check also those, you need to adjust the code.
    2. The $assign_point variable is not defined before the IF check, if the user is in a group outside of the listed IDs, PHP 8 will throw an error about an unknown variable.
    3. I see that you're basically loading the credit balance from a table, adding 250 to it, and then updating the same table back. The whole process can be simplified in a single query instead.

    Here's an updated code based on the points above:

    	protected function processAfterCreate($comment, $values)
    	{
    		# Remove prefix
    		$previousPrefix = \IPS\Db::i()->prefix;
    		\IPS\Db::i()->prefix = '';
    		
    		# Comment/uncomment either line below based on what you want
    		#if ( \in_array(  \IPS\Member::loggedIn()->member_group_id, array( 3, 4, 7, 8 ) ) ) # This line checks only the primary group
    		if ( \IPS\Member::loggedIn()->inGroup( array( 3, 4, 7, 8 ) ) ) # This line checks also secondary groups
    		{
    			# Update database with new $cc value
    			\IPS\Db::i()->update('plug_mailing_master', "credit_balance=credit_balance+250", array('user_id=?', \IPS\Member::loggedIn()->member_id));
    		}
    		
    		# Reset prefix
    		\IPS\Db::i()->prefix = $previousPrefix;
    		
    		return parent::processAfterCreate($comment, $values);
    	}

    The code checks if the user has one of the specified groups, and adds 250 to their credit balance value based on their member ID. No need for anything else.

     

    P.S.: If you use the Code button in the editor the code you post will look better and formatted for the appropriate language. 😉

    One more query is, when some one replied to this Topic, which event is fired internally.

  6. 26 minutes ago, Jyoti Rani said:

    Hello terabyte,

    A very big thanks to your help and prompt reply. I was able to do the changes as per your suggestions. Here is my final code and its working when user is adding Topic at my local machine.

            protected function processAfterCreate($comment, $values)
            {

                # Remove prefix
                $previousPrefix = \IPS\Db::i()->prefix;
                \IPS\Db::i()->prefix = '';

                $user_group_id = \IPS\Member::loggedIn()->member_group_id;
                if ($user_group_id == 3 || $user_group_id == 4 || $user_group_id == 7 || $user_group_id == 😎 //bronze // || $user_group_id == 4)
                {
                    # no need to check for double points
                    $assign_point = 1;
                }

                if ($assign_point == 1) {
                    $reward_mailing_points = 250;
                }
                $result = \IPS\Db::i()->select('*', 'plug_mailing_master', array('user_id=?', \IPS\Member::loggedIn()->member_id));
                foreach ($result as $row) {
                    $credit_balance  = $reward_mailing_points + intval($row['credit_balance']);
                }

                # Update database with new $cc value
                \IPS\Db::i()->update('plug_mailing_master', array('credit_balance' => $credit_balance), array('user_id=?', \IPS\Member::loggedIn()->member_id));

                # Reset prefix
                \IPS\Db::i()->prefix = $previousPrefix;
                return parent::processAfterCreate($comment, $values);
            }

     

    Its working on the betaversion of the site also. Thanks a Ton!

  7. 14 hours ago, teraßyte said:

    I'm having a really hard time understanding your code because it's all partial or missing context and variables.

    Anyway, you can temporarily disable the prefix in the database class if your tables don't have it. Or you can keep using manual query() calls, but there is no need to use mysqli_fetch_assoc.

     

    See the code below, I tried to update your processAfterCreate() function above with more consistent code:

    	public function processAfterCreate($comment, $values)
    	{
    		# Remove prefix
    		$previousPrefix = \IPS\Db::i()->prefix;
    		\IPS\Db::i()->prefix = '';
    		
    		
    		# Vars
    		$reward_mailing_points = 10; # Not sure where you're pulling this value from, so I set an arbitrary 10 here as example
    		$cc = 0;
    		
    		# Get result - If this query always returns only 1 row, it can be changed to use ->first()
    		$result = \IPS\Db::i()->select('*', 'xxxx', array( 'user_id=?', \IPS\Member::loggedIn()->member_id ) );
    		
    		foreach( $result as $row )
    		{
    			$cc += $reward_mailing_points + intval($row['cc']);
    		}
    		
    		# Update database with new $cc value
    		\IPS\Db::i()->update( 'xxx', array( 'credit_balance' => $cc ), array( 'user_id=?', \IPS\Member::loggedIn()->member_id ) );
    		
    		# Reset prefix
    		\IPS\Db::i()->prefix = $previousPrefix;
    		
    		return parent::processAfterCreate($comment, $values);
    	}

    Hello terabyte,

    A very big thanks to your help and prompt reply. I was able to do the changes as per your suggestions. Here is my final code and its working when user is adding Topic at my local machine.

            protected function processAfterCreate($comment, $values)
            {

                # Remove prefix
                $previousPrefix = \IPS\Db::i()->prefix;
                \IPS\Db::i()->prefix = '';

                $user_group_id = \IPS\Member::loggedIn()->member_group_id;
                if ($user_group_id == 3 || $user_group_id == 4 || $user_group_id == 7 || $user_group_id == 😎 //bronze // || $user_group_id == 4)
                {
                    # no need to check for double points
                    $assign_point = 1;
                }

                if ($assign_point == 1) {
                    $reward_mailing_points = 250;
                }
                $result = \IPS\Db::i()->select('*', 'plug_mailing_master', array('user_id=?', \IPS\Member::loggedIn()->member_id));
                foreach ($result as $row) {
                    $credit_balance  = $reward_mailing_points + intval($row['credit_balance']);
                }

                # Update database with new $cc value
                \IPS\Db::i()->update('plug_mailing_master', array('credit_balance' => $credit_balance), array('user_id=?', \IPS\Member::loggedIn()->member_id));

                # Reset prefix
                \IPS\Db::i()->prefix = $previousPrefix;
                return parent::processAfterCreate($comment, $values);
            }

     

  8. 1 hour ago, teraßyte said:

    A few things:

    1. In the query, you are using $user_id, but there is no such value defined anywhere in the code.
    2. You are not saving the updated $cc value back to the database, that's why it's not working.
    3. You're using a mix of IPS and non-IPS functions to access the DB data. You should stick to using a single method to keep things consistent.
    4. Is the table you're trying to update in the same database as Invision Community? If it's in an external database, you're using the wrong code to connect to it. Using simply \IPS\Db::i() will try to load the table from the forum's database, not your external one.

    point 2 in the try block i m using below statement also

    $result = \IPS\Db::i()->query("UPDATE xxx SET credit_balance = " . $credit_balance . "   WHERE user_id = '" .  $user_id . "'"); 
    point 1 User id i m getting using below code 
                if (\IPS\Member::loggedIn()->member_id) {
                    //  // Get the current user's member object
                    $currentUser = \IPS\Member::loggedIn();
                    //  // Access user data
                    # Fetch member details

                    $user_id = $currentUser->member_id;
                    $username = $currentUser->name;
                    $email = $currentUser->email;
                    $user_group_id = $currentUser->member_group_id;
                } else {
                    $user_id = 0;
                }

    point 3 - my table name does not start with tbl_prefix. that is why i have to use mix  IPS and non-IPS

    4. Is the table you're trying to update in the same database as Invision Community? - YES.

    If it's in an external database, you're using the wrong code to connect to it. Using simply \IPS\Db::i() will try to load the table from the forum's database, not your external one. - My table is in the same db not the external db.

     
  9. 22 minutes ago, Adriano Faria said:

    I have a ton of resources using this. Show your code.

            public function processAfterCreate($comment, $values)
            {
                $result = \IPS\Db::i()->query("SELECT * FROM xxxx WHERE user_id = " .  $user_id); // SET field_a='value' WHERE id_field=1");
                if ($result->num_rows > 0) {
                    while ($row = mysqli_fetch_assoc($result)) {
                        // $row is now an associative array containing column names as keys
                        $cc  = $reward_mailing_points + intval($row['cc']);
                    }
                }
                return parent::processAfterCreate($comment, $values);
            }

            public function save()
            {
                $result = \IPS\Db::i()->query("SELECT * FROM xxxx WHERE user_id = " .  $user_id); // SET field_a='value' WHERE id_field=1");
                if ($result->num_rows > 0) {
                    while ($row = mysqli_fetch_assoc($result)) {
                        // $row is now an associative array containing column names as keys
                        $cc  = $reward_mailing_points + intval($row['cc']);
                    }
                }
                return parent::save();
            }

  10. 7 minutes ago, Adriano Faria said:

    Could contain: Text, Page

     

    Not sure I follolw your question. Do you want to upload your own hook to the dev install?

    Make sure you make a copy and keep the dev folder of your app/plugin. You will need to work in your app/plugin in the future.

     

    10 minutes ago, Adriano Faria said:

    Could contain: Text, Page

     

    Not sure I follolw your question. Do you want to upload your own hook to the dev install?

    Make sure you make a copy and keep the dev folder of your app/plugin. You will need to work in your app/plugin in the future.

    But i m not getting this dropdown in my screen.

    Please see below

     

    Could contain: Page, Text

  11. 20 hours ago, teraßyte said:

    You can use the DB class to run queries, there is no need to use a separate dbconnect.php file:

     

    By default its taking ip in the table name. Earlier in the version 3.6 we have used the table name without the tbl_prefix. So, Can you help me how to use the how to fetch the data directly from the table without using tbl_prefix?

  12. 5 minutes ago, Marc Stridgen said:

    Its actually a PHP bug. We have worked around this in the next upcoming release

    Actually i got this while working at my local machine. As per the comments on the forum, I restarted my system and i am getting below issue.

    Could contain: File, Webpage, Page, Text

    Can you please suggest something? My all the efforts for the hook and local setup gets wasted. 

×
×
  • Create New...