QUESTION Get admin email - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16) +--- Thread: QUESTION Get admin email (/showthread.php?tid=6558) |
Get admin email - lukinhasb - 2014-07-11 How can I get the admin e-mail inside a plugin php? The same entered during install, and seen on Settings Thanks. -- Edit -- If someone looks for this function on the future, here it is: PHP Code: /* RE: Get admin email - frixelsolutions - 2014-07-11 This data is stored in /data/users/admin.xml so you can pull the email address from there. RE: Get admin email - lukinhasb - 2014-07-11 Yes, but the name of the file is dynamic, the username isn't necessarily "admin" I was trying something like this: PHP Code: function admin_email() It returns a blank page though Edit: My second try, didn't work neither PHP Code: <?php RE: Get admin email - Carlos - 2014-07-11 Maybe with: Code: global $EMAIL; RE: Get admin email - lukinhasb - 2014-07-12 (2014-07-11, 23:27:50)Carlos Wrote: Maybe with: Sorry, I didn't understand your answer, can you explain it a little further please? Thanks RE: Get admin email - shawn_a - 2014-07-12 you did not specifcy from frontend or backend ? Logged in user, or any arbitrary user email ? There is no such thing as "admin" in getsimple. PHP Code: $user = 'admin'; RE: Get admin email - Carlos - 2014-07-12 I think that the global $EMAIL variable contains the current (logged in) user name. However, I hadn't realized you said this: (2014-07-11, 07:17:11)lukinhasb Wrote: The same entered during install, and seen on Settings If there are several users in the site, you cannot know which one did the install (or if it still exists) RE: Get admin email - lukinhasb - 2014-07-12 (2014-07-12, 00:44:54)shawn_a Wrote: you did not specifcy from frontend or backend ? I'm sorry, it's from the backend. Assuming there will be only one user, and I don't know his username, how can I retrieve his e-mail? (I'm trying to do a website that can be set up in less than 5 minutes, and the contact form should be pre-configured with the e-mail inserted during Get-Simple installation, to save time. I'll block the add/remove user functions) RE: Get admin email - shawn_a - 2014-07-12 global $EMAIL like carlos said probably does not exists but you can use. $datau->EMAIL there is get_site_email($echo=true); But it uses global $EMAIL, but i do not see if ever getting set in common.php so i am not sure it works. It is also only available on front end pre 3.4 new issue (https://github.com/GetSimpleCMS/GetSimpleCMS/issues/868) so nevermind use $USR_email = trim(stripslashes($datau->EMAIL)); RE: Get admin email - Carlos - 2014-07-12 Sorry for my misleading reply. As Shawn says $EMAIL does not currently work. That was in GS 2.x If you want to get the current (logged in) user's email you can do as Shawn suggests above. However if you want a main email address that also works for frontend anonymous users, I suggest you define it in gsconfig.php, changing: Code: #define('GSFROMEMAIL', 'noreply@get-simple.info'); Code: define('GSFROMEMAIL', 'youremail@domain.com'); Code: if (defined('GSFROMEMAIL')) { RE: Get admin email - shawn_a - 2014-07-12 Just be aware that this is the sending email used for sending emails, and it could be a noreply@ etc. which would go nowhere. I wonder if $EMAIL got removed. RE: Get admin email - Carlos - 2014-07-12 Yup, another wrong answer... definitely not my day, sorry. RE: Get admin email - lukinhasb - 2014-07-17 Thanks for all your help guys. It's solved though, found this code on Simple ©ontact plugin: http://get-simple.info/forums/showthread.php?tid=1033&pid=44287#pid44287 PHP Code: /* RE: Get admin email - shawn_a - 2014-07-17 That is some aweful code |