Jyoti Rani
-
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
-
-
45 minutes ago, opentype said:
It’s the calls to FontAwesome in the theme. You really need to make sure that the theme doesn’t contain hard-coded links and that the cache is completely cleared. It then should automatically load the fonts from the proper location.
Can you please share the file location where i should add this link?
-
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
-
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?
-
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.
-
I have upgraded site on subdomain, Now i want to move those files on root of the site. and there will be change in the URL of the site.
Will this work or i have to perform the upgrade again?
Please guide
-
It has been resolved Dawpi. Thanks for the reply!
-
43 minutes ago, DawPi said:
Did you changed your board URL in the conf_global.php file?
Yes.
-
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 .
-
-
19 minutes ago, Daniel F said:
php class: \IPS\forums\Topic\Post - Its fine.
Should i add my functionality in below
protected function processAfterCreate($comment, $values)
function or any other function/Method should be used?
-
I want to create a plugin. So, i just want to know
Which IPS class and event is fired, when i add reply to new topic in forum?
-
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:
- 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.
- 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.
- 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.
-
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!
-
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);
} -
1 hour ago, teraßyte said:
A few things:
- In the query, you are using $user_id, but there is no such value defined anywhere in the code.
- You are not saving the updated $cc value back to the database, that's why it's not working.
- 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.
- 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.
-
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();
} -
Can you please tell me which event is called when New topic is created.
in the processForm function - It is called during both time while editing and creating.
But i need only when its created. I used save() , processAfterCreate(), createFromForm() and some mor but they are not being called while creating new topic.
-
14 minutes ago, Adriano Faria said:
Enable IN_DEV mode. It will appear.
Yes. Thanks again for your prompt reply!
-
7 minutes ago, Adriano Faria said:10 minutes ago, Adriano Faria said:
But i m not getting this dropdown in my screen.
Please see below
-
20 minutes ago, Jyoti Rani said:
Found the solution as you mentioned at the same place Adriano. Thanks for the reply!
Now another query is, there is xml file which gets generated in the end.
But how to create it?
How to upload it to sever from developer's mode at local?
-
23 minutes ago, Adriano Faria said:
Search for external on
Found the solution as you mentioned at the same place Adriano. Thanks for the reply!
-
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?
-
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.
Can you please suggest something? My all the efforts for the hook and local setup gets wasted.
-
On 3/27/2023 at 3:35 PM, Marc Stridgen said:
Are you having issues after having moved server?
Hello Marc,
Did you able to find the solution for this issue?
I have upgraded site on subdomain, Now i want to move those files on root of the site.
in Developer Connection
Posted
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.