granville
Forum Replies Created
-
Forum: Hacks
In reply to: redirect post after submission to a thank you screenOkay, back again.
So slight change in design. Instead of redirecting to a thank you page, the concept is now to redirect back to a fresh “new post” page.
I already am redirecting any user who is not an admin from the dashboard to the new post page, so I simply decided to redirect them to the “wp-admin” page after submission.
Code is here:
<?php add_filter('redirect_post_location', 'redirect_to_new_post'); function redirect_to_new_post() { if (!current_user_can('edit_pages') && (isset($_POST['save']) || isset($_POST['publish']))) { wp_redirect('../wp-admin'); } } ?>
So I thought I had it all working smoothly. If the user is not the admin then it works fine.
However, if the user is the admin, then after editing a page it redirects to a blank screen. Viewing source shows me that it’s trying to show a page relating to a forgotten password. If I click back, then the update has taken effect.
Can you help me understand why the admin publish page is being affected, and what I can do to correct it?
Thanks
G
Forum: Hacks
In reply to: redirect post after submission to a thank you screenThanks for spotting that – yes it was that simple and I was that stupid…no more hangover web development for me.
Final comment for what it’s worth; I have ultimately opted for the if statement to start if(!current_user_can(‘edit_pages’)
so that it only targets the contributors and not any editors that I may create in the future.
Thanks for your help apljdi.
Kind regards
GForum: Hacks
In reply to: redirect post after submission to a thank you screenOkay, so I decided that the best way would be to only have this function apply if it is not the admin logged in. (I only have the admin and the contributor as roles)
(The logic being that the admin should be able to do everything, but the contributor will only be uploading posts.)
So I amended the code as follows but it results in a white screen of death ??
Can anyone help me understand why?
add_filter('redirect_post_location', 'redirect_to_thank_you'); function redirect_to_thank_you() { if ((!current_user_can('level_10')) && (isset($_POST['save']) || isset($_POST['publish']))) { wp_redirect('https://www.MYURL.com/thank-you'); }
Thanks
GForum: Hacks
In reply to: redirect post after submission to a thank you screenHi apljdi
Thanks for the response.
I just realised that I’d forgotten a semi-colon – d’oh!
So this is the code that I came up with:add_filter(‘redirect_post_location’, ‘redirect_to_thank_you’);
function redirect_to_thank_you()
{
if (isset($_POST[‘save’]) || isset($_POST[‘publish’])) {
wp_redirect(‘https://www.MYURL.com/thank-you’);
}
}However, I now need to work on it as this also applies to new pages created too, and I really need it just for Posts. I’ll have a play with it to see if I can do it, but if you have any ideas too that would be great!
Cheers
G
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery] Thumbnails not generating, no errorsHello all
I had exactly the same problem. As martinfeeney suggested it might be image size, I used Photoshop to reduce the image to width:500px and height:333px and then -yippee!- it worked!
I haven’t experimented to see what is the maximum width/height combo but can safely say this worked for me.
I didn’t touch any jquery or other plugins.
P.S. I am using WordPress 3.1 and NextGen 1.7.4
Hope this helps.
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery] Thumbnails not generating, no errorsForum: Plugins
In reply to: [Plugin: Category Posts Widget] Stripping CodeI have a similar question and tried your answer – however, this removes the excerpt and replaces it with the full content. So while this works, you can no longer limit the content to 250 (or whatever) characters.
Does anyone have a solution for amending the_excerpt so that it keeps the html tags, such as ul and li; and in pantone24’s case the a tags?