Welcome Guest. Please Login or Register  


You are here: Index > Softaculous Auto Installer > General Support > Topic : Inserting [[softurl]] in Custom WP Script



Threaded Mode | Print  

 Inserting [[softurl]] in Custom WP Script (3 Replies, Read 4036 times)
perrybv
Group: Member
Post Group: Newbie
Posts: 6
Status:
Hello,

I've created a custom WP install script but am having one issue. The widget table utilizes a hard-coded URL and I want to change it to [[softurl]] and can't figure out how to do that.

Here's the example:

(80, 'widget_text', 'a:7:{i:2;a:9:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:230:\"<span style=\"font-size:25px; color:#ffffff; letter-spacing:2px; padding-right:35px;\">Don\'t Wait to Get the Help You Need</span> <a href=\"Want_SoftURL_Here/appointment-request/\" class=\"btn\">

Thank you for your help!
IP: --   

Inserting [[softurl]] in Custom WP Script
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
Hi,

If the above query is in the .sql file, you can directly use [[softurl]] and it will be replaced while importing the SQL file into the database.
https://softaculous.com/docs/Making_Custom_Package#6._SQL_file

If you are executing the query in a PHP file then you can use the variable $__settings['softurl']
https://softaculous.com/docs/Making_Custom_Package#Explanation_of_Important_Variables

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

Inserting [[softurl]] in Custom WP Script
perrybv
Group: Member
Post Group: Newbie
Posts: 6
Status:
Hi Brijesh,

Unfortunately that is not working. It is breaking the widget creation process in SQL.

Again, this is in the wp.sql file.

Here is the code sample:

(80, 'widget_text', 'a:7:{i:2;a:9:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:230:\"<span style=\"font-size:25px; color:#ffffff; letter-spacing:2px; padding-right:35px;\">Don\'t Wait to Get the Help You Need</span> <a href=\"[[softurl]]/appointment-request/\" class=\"btn\">

Thanks for your help!
IP: --   

Inserting [[softurl]] in Custom WP Script
Brijesh
Group: Softaculous Team
Post Group: Super Member
Posts: 5652
Status:
As it seems your data is in serialized format so if the number of characters in URL changes it will break the serialize format.

What I can suggest is do not replace the [[softurl]] in the SQL file. Let it import with the default values then in the __install() function of install.php, execute a SELECT query to get the data then unserialize the data update the value in the array and then serialize it and use UPDATE query to update the data in the database.

-----------------------
Webuzo - Multi User Hosting Control Panel
AMPPS - Best WordPress/PHP/MySQL development tool
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is April 25, 2024, 3:16 pm.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.033