foxymcfox
Forum Replies Created
-
Forum: Plugins
In reply to: [Join My Multisite] "Per Site" Option Won't Display…I’ve got to start getting more than 2 hours of sleep a night then. haha
Thanks as always.
-Nick
Forum: Plugins
In reply to: [Join My Multisite] "Per Site" Option Won't Display…And just as quickly as the problem came up…it went away. Weird. I didn’t even do anything, it just started working again.
I think I have some gremlins in my internet.
The other issue though still stands, I swore I was able to activate JMM on a per-site basis before rather than having to network activate. Am I just imagining things?
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?I hear that. I was still working at 10PM, my time, when I finally decided to call it a day…just because I thought a 15 hour day was a tad excessive after two 16 hours ones. haha
I’m looking at adding a few other helpful elements some people should find useful as well:
-Domain array, for people who need more flexibility than my one email domain per one subdomain
-Easily customizable error messages
-Possibly an optionally customizable redirectIf anyone has any ideas as well, feel free to grab the code and have some fun. Mika, has really created a really robust base to fork from.
Thanks again, for all of your help and fantastic plugin, Mika!
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?Okay, I finally hit a wall where I think I’ll need your guidance as the plugin creator.
Here is the code as it stands now:
$jmm_options = get_option( 'helfjmm_options' ); $whitelist = $jmm_options['emailwhitelist']; $checkemail = explode("@", $user_email); $checkemail = $checkemail[(count($checkemail)-1)]; $verifyemaildomain = strpos($checkemail, $whitelist); if ($verifyemaildomain === false) { return $errors->add( 'invalidemaildomain', '<strong>ERROR</strong>: We are not currently accepting registrations from your email domain.' ); }
…and it works!
However it doesn’t return the error message. It simply sends the user to a blank version of the signup page with no warning or alert. It does, however, prevent registration from all domains except the whitelisted domain.
I was thinking that I may have to add some code to another section of the signuppage.php file, such as the “show_user_form()” function in order to have them sent back to the signup page with the accompanying error message, but I’m just not sure.
Any advice on how to implement that? Once that’s in place, this will work perfectly!
Again, I really appreciate your help and guidance on this, it’s been a HUGE help.
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?MAN! I am a dummy sometimes. One line of code and I’m pulling values again!
All I had to do was add this line:
$jmm_options = get_option( 'helfjmm_options' );
Inside of that function to be able to pull the value. I hate how the obvious problems end up being the ones that take up the most time.
Here’s where the signuppage.php additional code stands now:
$jmm_options = get_option( 'helfjmm_options' ); $whitelist = $jmm_options['emailwhitelist']; $checkemail = explode("@", $user_email); $checkemail = $checkemail[(count($checkemail)-1)]; $verifyemaildomain = strpos($checkemail, $whitelist); if ($verifyemaildomain === false) { //Negative Result - replace with error echo "The string '$whitelist' was not found in the string '$checkemail'"; } else { //Positive Result - replace with completion echo "The string '$whitelist' was found in the string '$checkemail'"; }
I’m an idiot sometimes, but at least I can admit it. haha
Now to take a short break and then add in the code to use this as validation criteria!
Hopefully this is of use to some people out there looking to do something similar.
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?Okay, after a good night’s sleep, I came at this with fresh eyes and made a few fixes. (It’s amazing what a missing underscore can do) And it seems to be on the right track again:
//Replace this with the whitelist value $whitelist = "whateverdomain.com"; $checkemail = explode("@", $user_email); $checkemail = $checkemail[(count($checkemail)-1)]; $verifyemaildomain = strpos($checkemail, $whitelist); if ($verifyemaildomain === false) { //Negative Result - replace with error echo "The string '$whitelist' was not found in the string '$checkemail'"; } else { //Positive Result - replace with completion echo "The string '$whitelist' was found in the string '$checkemail'"; }
I’m just hardcoding the whitelist in for the time being until I can work out why the value isn’t being pulled from the settings page, but at least it’s progress.
I’m going to have another dig around in the files to see what I can work out.
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?The email domains may not always be character for character what the subdomain is, but there will always only ever be one email domain allowed per site…if that makes sense.
That way, if someone sets up a site for XYZ Company and wants to used the company’s full name in the domain but they use a different naming convention for their email domain it will be allowed. So they could be XYZCompany.site.com, with email addresses having the domain XYZComp.com.
And after fooling around with that code, it doesn’t seem to do the job either. Initially, I just swapped out “in_array” for “strpos” since I’m only checking one value, and that at least squashed the php error.
However, it’s still not working, but interestingly, I think my mistake may have been on the settings page. So my modification of your code above may still work.
For whatever reason I cannot call the value of the whitelist. I’ve simply tried echoing it on the signup page and it returns empty single quotes instead of the dummy domain I put in. So now I’m basically back to square one.
Is there another file within the plugin I need to modify to allow my whitelisted domain to be called like all of the existent parameters in the settings.php file?
Thanks so much for all of your guidance. I really appreciate it.
-Nick
EDIT: I also wanted to add that the setting page holds the dummy value, so it seems it’s being posted. But for some reason I just can’t retrieve the value on the signup page, hence why all of my tests always show the email address as invalid.
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?Cool, where here’s where I stand with my crappy knowledge of PHP, so far.
I’ve added the following to the settings.php file:
Under “$new_options” I’ve added:
$new_options['emailwhitelist'] = $_POST['jmm_emailwhitelist'];
Then later, in the area where admin options are generated:
<tr> <th scope="row"><?php _e('Allowed Email Domain:', 'helfjmm'); ?></th> <td><p> <input type="text" name="jmm_emailwhitelist" id="<?php echo $jmm_options['emailwhitelist']; ?>" value="<?php echo $jmm_options['emailwhitelist']; ?>"> </p></td> <td><p class="description"><?php _e( 'Use this field to allow ONLY users from a particular email domain to register', 'helfjmm' )?></p></td> </tr>
What I’m struggling with now is the validation in signuppage.php.
What I was thinking was that I might be able to check it using strpos. Would it work if I did something like this, or am I overcomplicating things:
$whitelist = $jmm_options['emailwhitelist']; $pos = strpos($useremail, $whitelist); if ($pos === false) { //code to disallow registration } else { //code to allow registration }
Thoughts?
I make stupid errors all the time in my code, (I’m thankful for debuggers everyday) so feel free to be brutal…I’m only a code “noodler” and not a programmer. Sometimes I need to have the information beaten into me. haha
-Nick
EDIT: Hmmm, doesn’t seem to actually be validating. It’s saying that any email address is invalid. I know this has to be some sort of stupid little thing I’m missing that’s causing it, I just don’t know what.
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?That’s fine, I’m fine doing some leg work. You’ve already given me a great base to work from with your write up and plugin.
And like I said, any solutions I come up with will be posted here to be shared with the community.
I hope you don’t mind if I make my own mods to your plugin…
-Nick
Forum: Networking WordPress
In reply to: Restrict Domains on a Per-Multisite Basis?I am the king of specialized setups. I was here back when WordPress was blogging only, and finding fun ways to make it into a more robust CMS. So why make things easy on myself now? haha
I’ve only had a chance to skim that article so far, but I want to go back and reread it thoroughly. If I’m not mistaken, what it’s accomplishing is very similar to what I’m having the plugin “Join My Multisite.” I may have to look into following your advice, rolling my own sign-up, then forking the code to run the domain check. That way I don’t have to worry about the plugin losing support.
Thanks for the help, it’s why I love this community!
And when I find my solution (It’s not even a matter of if) I’ll report back and post my results so that if there is even one other person who needs to make this implement this functionality, they can.
-Nick
Forum: Networking WordPress
In reply to: Automatically Be Added as SuperAdmin to User Created MultisitesSo, did you just make this a standalone, single-function plugin, or did you tag it on to another one of your plugins? I’m just trying to understand your process.
Thanks for the code! It’s one of those things that seems so obvious once you actually see it.
I owe you a virtual drink! haha
-Nick
EDIT: Since I didn’t make it clear here, I put that code in a plugin wrapper, uploaded it, activated it ONLY on the base URL, (Not network activated) and it works perfectly…hence me owing you an e-Drink. I was just curious about your implementation.
Forum: Networking WordPress
In reply to: Don't share users access between 2 blogs (multi site)I’m using Join My Multisite to do this on one of my sites. It requires a little more work to make everything seamless, but it allows you to create blog-specific signup pages with just a line of short code. That way when users sign up, they are ONLY signing up for the multisite/network site that they are actually visiting.
-Nick
Forum: Networking WordPress
In reply to: Multisites with Identical Content…is it possible?I thought I already responded to this thread, but I guess the internet ate it.
I just wanted to say thank you. Those plugins are EXACTLY what I was looking for.
This is why I love this place.
-Nick
I’ll be joining up for the official support forum in the first few days of the new year. (When this project officially starts for me)
I’ll start a companion thread for this, then.
I really appreciate your detailed assistance.
-Nick
Forum: Networking WordPress
In reply to: Multisites with Identical Content…is it possible?All of the multisites and their content will act more as intranets for each of these companies and locked down to (hopefully) make their content invisible to Search Engines.
The only thing available to the search engine crawlers will be the root domain with the basics of the services offered on the site…none of the content I plan on duplicating.
So you said its possible. Is there an easy way to clone a multisite and then make sure that all future posts get put on all of them at once within the system?
Thanks,
Nick