Ryunosuke
Forum Replies Created
-
Oh for Pete’s sake! Now I don’t have permission to edit my own topic. FFS!
I figured it out so never mind. Thanks
Forum: Fixing WordPress
In reply to: Contradicting text in the documentationMy bad. I just noticed I missed the “also use” part of the one page. It intends to say to handle logged in and logged out users, use both hooks. I misread that. My mistake.
Now I just need to figure out why I can call actions using wp_ajax_ in which it tells me the user is not logged in. Clearly that can’t be right… But I’ll figure that out myself. This thread was supposed to report contradicting documentation entries but it turns out it was my bad eye causing me to read wrong ??
Apologies all
Forum: Networking WordPress
In reply to: My custom post types don’t show up in multisite admin panelsOkay, well I still don’t understand why my custom post type is not appearing but I did find a hack around it. It all started when I found there is a ‘network_admin_menu’ hook.
It appears that for normal sites the custom post types are registered during ‘init’ as the documentation expressly states “You should only do that during the init hook”, fine, but for admin menus that has no result so I have to add it manually. But here comes the catch… How do you make a menu item that goes under a specific menu and redirects to the page you want?
Why is this an issue? Well, because the add_submenu_page function stated it wants a FUNCTION to be called when the item was clicked. Simply adding the URL there resulted in “This is not a function, you fool” errors. So I tried to make it call a function that goes to the page in question… But how do you tell php to load a new page?
Google it and you will find 3 billion posts telling you “use header() but do so before any output is written” or people that say “if you can’t use header() because you already have content printed to the screen then you have coded your website wrong”. Do you hear that, WordPress developers? The internet is unanimous that your entire admin system is coded wrong because you can’t first SHOW people the button they can click on, oh no, the link the button goes to should open up BEFORE the user gets to click on the link. How stupid of you to not realise such a huge mistake? Fix WordPress NOW, I say….
So after I realised that that was not going to work I started looking at other angles at which to approach this and finally found something that works to some extent. I would have preferred to be able to stay in the network admin panel while creating a new entry but (now that I think about it) it seems rather daft… of course the post will have to go into the tables of one of the websites so it makes sense that when I click on the menu item it first goes to the main website before making the post…
So, with the exception of having to return to the network admin page to make use of all the other custom functionality I added to WordPress, this hack of mine seems to work nicely.
if (is_multisite()) add_action('network_admin_menu', 'add_wuss_games_submenu'); function add_wuss_games_submenu() { add_submenu_page( 'wuss_framework', 'wuss_games_overview', 'Wuss Games', 'manage-wuss', admin_url('/edit.php?post_type=wuss_game'), null ); }
As you can see, I use the URL I want to load as the menu_slug parameter. I don’t know why it works but it works perfectly… The very definition of a hack if you ask me ??
Hi there.
Thanks for the suggestions. If you wouldn’t mind, would you please move this to whichever one you feel is more likely to get me a response? If I have to make a new post I’m just going to asking the exact same thing again so I don’t see any logic in retyping what could just be moved ??
Again, thanks for getting back to me with those suggestions. This is the single greatest WP mystery I have yet encountered and I would love to get an answer to this ??
Forum: Fixing WordPress
In reply to: HTTP Error when loading images after Upgrading to WordPress 4.4After struggling with this issue myself for absolute ages, reading post after post after post of opinion and copy pasted rehashes of the same useless answers I finally found one link that solved this issue for me…
My website was setup to use FactCGI. I simply went into my control panel, changed it to CGI and rebooted my VPS. After weeks of showing “Under construction” messages with random, unrelated images on my website background, I am now finally able to upload a relevant image for my site background!
Such a simple solution… So much PT to get the answer… Well now you have it. Enjoy
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?I was just wondering “It does? How did I miss it?” So I had another look…
I still can’t see it. I can see it saying “super admin has all capabilities” but that is not what I was asking. I was not asking “is there any capability the super admin doesn’t have” I was asking if the super admin should have capabilities that DON’T EXIST.
I don”t see the note in the capabilites page that says: “super admins do, by default, have all capabilites AS WELL as any and all capabilities that don’t exist”. If I am missing it then I apologise for missing it each time and wasting anyone’s time.
Thing is, I am a rather clever boy, no escaping that… ?? …but my memory has more holes than chicken mesh. I can create a capability now, open up the next tab and already I forgot the spelling I just used 10 seconds ago. If I don’t copy past then I am working with luck… So when I guess a capability and see it working I am so super happy that I remembered the name and rhe soelling I chose… And then, one fateful day I see that even when I do it wrong, it still works… And I start wondrring “Why?” So I asked…
One thing that I still can’t figure out is why I can use stuff in quotes and without quotes and it still works. I am thus never sure when it is supposed to be in quotes and when not.
Example:
To use a variable, you prefix it with $ so this is a variable
$field
And this is a value contained inside a variable
‘Value’
I.e. $field = ‘value’;Simple… Fields and values make sense… But why is this both correct:
current_user_can(‘value’)
current_user_can(value)According to me, the second one should cause an error…and yet it is fine… Now, the add_menu_page function… i use that with and without cause I am never sure which it is supposed to be or wether it makes a difference or not… So when I see it works, I’m happy…but when I realise I make clear and obvious mistakes and it still works… i get worried…
So I asked…
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?Yeah, I know, i got a bit over-emotional here asking the same thing over and over and getting replies that dance around the subject without actually answering the question, just forcing me to ask the same thing over and over again.
As you can see, I DID i stall the kit on single jser and multisite and the fact that you still take me on making it sound like i am incapable of doing so just points once more to the fact that I am speaking to a wall.
In any event, though, I am going to consider this issue sooved and say ‘yes, the super admin can do things that are not supposed to run’. Even if the capability does not exit for anyone, even if the capability has never ever been defined by anyone anywhere in world, ever, in all of history, the super admin still has that capability. Cool, is all I wanted to know ??
Sorry I lost my temper. Thanks for taking the time out of your day
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?Clearly you are not paying attention…
Please look at that code again.
I am telling you that IronMan swings from his web and clings to walls and you are saying ‘But of cours,stupid! It’s IronMan. He is strong enough to cling to buildings”
Please pay attention or stop wasting my time with useless comments.
Look at the NAMES of the capabilities! The NAMES! The whole point of the question and the thing I’ve asked this whole time! This post is about the NAMES if the capabailites! The NAMES! And just in case you didn’t get it, yet, the N.A.M.E.S! Got that? The names! Thise things that are rather important but you seem to think don’t matter.
Notice the NAME of the capability I give the admin. Now pay attention to the NAME of the capability I test against! Can you spot the difference in spelling between the three words that don’t look anything at all alike? Or do you still think that Superman should turn green and and attack the nazis with his shield while sitting comfortably inside his invisible plane created by the ring on his finger?
Please pay attention to what is going on or do not reply to my sincere request for assistance if you cannot do that.
Thanks
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?Okay… Uploaded this to a single site and the menu item does NOT show up for Admins
Uploaded it to my multisite and the menu appears for the super admin only
Since this is happening on two sites I guess it is safe to assume the answer to my question is “Yes, it is normal behaviour”
I would greatly appreciate it if someone with a multisite would try that above kit and just verify it on your end also…
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?Okay… Just started from scratch and created a new plugin. Here is the ENTIRE plugin…
<?php session_start(); /* Plugin Name: Plugin Test Plugin URI: https://wuss.mybadstudios.com/ Description: Nothing yet Version: 1.0 Network: true Author: myBad Studios Author URI: https://www.mybadstudios.com */ function activate_wussy() { $role = get_role( 'administrator' ); $role->add_cap( 'random_cap' ); } function deactivate_wussy(){ $role = get_role( 'administrator' ); $role->remove_cap( 'random_cap' ); } register_activation_hook( __FILE__, 'activate_wussy' ); register_deactivation_hook( __FILE__, 'deactivate_wussy' ); include_once('mysettings.php');
and then mysettings.php is this:
<?php function register_test_menu() { add_menu_page("Test", "TEST", 'do_random_stuff', "test-settings", show_test_config, 'dashicons-smiley'); } add_action( 'admin_menu', 'register_test_menu' ); function show_test_config() { if ( current_user_can('manage_non_existent_stuff') ) echo "Yes he can"; if ( current_user_can(manage_other_non_existent_stuff) ) echo "Yes he can do this also"; }
The result is a window that shows:
Yes he canYes he can do this also
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?I’m honestly not sure what to do… I am already runing a multisite locally as that is where I test my code on. I have no idea how to configure apache to allow me to run a single site and a multisite on the same system… sure it can be done, I just don’t know how.
But even if I did that, that is not going to be prove much since when I did this I just started the project and the options page was the first thing I did. There was nothing else to the kit except the options page and even that still didn’t have anything in it… I was still at the “Register the page” phase when I forgot what the capability was so I guessed it and it worked. Later on I noticed I did spell it wrong and fixed it and it worked still…
So basically you are asking me to create a new site and create a new script and in that script just write this single line and see if that works???
add_menu_page("Stuff", "WUSS", manage_wuss, "wuss_settings", show_wuss_config,'dashicons-smiley');
I think I can safely say that line will work ?? All WordPress users the world over will agree with me that it works ?? But you did give me a good idea, though. I am going to start again (this kit has undergone a LOT of work since I made this post) and create a new plugin that does nothing but show a empty menu then upload it to my actual online multisite also and test it there.
I have always been under the impression that identical setups on different machines will run the same but this is a good enough way to verify there is nothing wrong on my local install.
Thanks.
p.s. Probably should have done hat before posting ??
Forum: Networking WordPress
In reply to: Should super admin have capabilities that don't exist?I don’t actually HAVE a single install of WP so not sure but when I log in as a normal user, it works as expected and doesn’t allow me to see the page.
As I understand it, a super admin had the ability to manage every single last thing on the website and that is what makes him ‘super’… the thing that I was asking is wether the super admin is supposed to be have a capability that doesn’t exist…
If there IS no ‘play_chopsticks’ capability, shouldn’t current_user_can report false for EVERYONE including the super admin? Or is this a security feature to make sure the super admin is not locked out of anything, ever?
Both answers would make perfect sense but in this instance it makes it hard for me to debug my code while logged in as super admin. I really don’t want to have to log in and out of accounts every couple of minutes…
Ah, I found the page that explains the product types…
Normal is for the physical goods
Normal + downloadable is for my digital goods
Normal + downloadable + virtual can be used for what I want to do.Ideally digital goods would also be virtual but if adding a new field (like postprocess_locally)/product type (internal_update) would be too much of a stretch, this is acceptable. So the main question now is how to make the transaction give me control at the point where the “Pay” button is pressed so I can manually adjust their balances and stock levels?
Products can have additional tags so I suppose just adding “postprocess_locally” and setting it to true for each product might actually work and avoid having to create a new product type so, although it is going to be a shlep to add that to each of the products manually, it could work… so half the battle is already won…
p.s. I forgot to mention… One of the big differences between my payment method and the normal woo stuff is that when you buy items using my payment method, the user should not receive any kind of download links to items since there is nothing to download. All purchases will go straight into their inventory and they can see it from there.
This payment method is to be used on more than just websites and will be required to, at times, send out plain text responses (without any header info like in normal html) so in that respect (like it not even needing to go to a ‘completed’ page afterwards or show a ‘transaction successful’ message of any kind but just respond with a code like 3 or 9 etc make me think that the existing product types will not be suitable to what I need to do which is why I asked about how to create a new one…
Thanks again
p.s. I tried setting Avoid content filter to Yes and No. No change…. ??