Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Plugins & Atahualpa »

[SOLVED] global variables


  #1  
Old Apr 11, 2011, 03:03 AM
todo1979
 
8 posts · Apr 2011
Hi to all,
maybe someone can help my with this one. On my local wamp server I have global variables activated and I can use sessions for one plugin I modified. The plugin in question is restrict-categories and based from which category (when a category is displayed I added a link to post-new.php) the user wants to post a new post it should give him the option to only check one category the post will be added to (basically all other categories are hidden except the one that the post will belong to).
In atahualpa center-column I added this:

session_start();
$eu_scattitle = single_cat_title("", false);
$eu_scatid = get_cat_ID($eu_scattitle);
$eu_curr_cat = get_category($eu_scatid);
$eu_slug=$eu_curr_cat->category_nicename;
$_SESSION['eu_slug'] = $eu_slug; //this is what I need to be stored and later use in restrict-categories

Now, because globals are disabled, the session variable is lost when the execution enters into another .php file.

Is there a way to declare the variable I need inside the center-column (or in one .php file that belongs to atahualpa) and later to be available in the restrict-categories function?... like global $wpdb; or something?

Thank you.
  #2  
Old Apr 11, 2011, 03:52 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Try adding
HTML Code:
Global $eu_slug;
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Apr 11, 2011, 02:25 PM
todo1979
 
8 posts · Apr 2011
It's not working,
as soon as another .php file starts execution, the variable is lost.... don't know what to do.... this happens on the site I have hosted by a company.... on my local computer, session variables work but....
  #4  
Old Apr 12, 2011, 06:47 AM
todo1979
 
8 posts · Apr 2011
No, I can't access php.ini
I just can't figure out why the variable is lost
  #5  
Old Apr 12, 2011, 07:46 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Contact your host and get them to turn them on. If they won't help you, I'd move hosts.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Apr 12, 2011, 10:16 AM
todo1979
 
8 posts · Apr 2011
Yes I think that is what I'll do, thank you. However, I understood that turning global variables on is quite risky, even if the entire platform only uses 1 session variable, will I have any hacker problems?
Thanks
  #7  
Old Apr 13, 2011, 02:00 AM
todo1979
 
8 posts · Apr 2011
Fixed, thank you so very much....

Bookmarks

Tags
global variables, todo1979

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
FR: Add variables to the paths to images, headers, logo, favicon, etc. interfasys Atahualpa 3 Wordpress theme 0 Jan 22, 2011 11:58 AM
[SOLVED] Notices on undefined indexes, variables and deprecated functions Knut Sparhell New Versions, & Updating 1 Jan 3, 2011 08:07 AM
Can't get a second row to enter HTML variables Thomas Sidebars & Widgets 18 May 16, 2010 09:59 AM
Accessing PHP variables after header sent out twola Sidebars & Widgets 1 Oct 2, 2009 11:24 AM


All times are GMT -6. The time now is 01:23 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.