sainib
Forum Replies Created
-
Forum: Plugins
In reply to: Delete Post LinkTry changing edit_page and edit_post to edit_pages and edit_posts (plural)
I checked wordpress documentation again just now and those are the correct capabilities. My GUESS is that function current_user_can returns true for admin without checking capability since admin has access to everything. SO give that a try.
If that does not work, try changing the capability to role name.. so change this
if ( $post->post_type == 'page' ) { if ( !current_user_can( 'edit_page' ) ) return; } else { if ( !current_user_can( 'edit_post' ) ) return; }TO
if ( !current_user_can( 'administrator' ) && !current_user_can( 'editor' )){ return; }Hope this helps..
Forum: Plugins
In reply to: Delete Post LinkHeres a better and ‘tested’ version of the function..
function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash") { global $post; if ( $post->post_type == 'page' ) { if ( !current_user_can( 'edit_page' ) ) return; } else { if ( !current_user_can( 'edit_post' ) ) return; } $delLink = wp_nonce_url( site_url() . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID); $link = '<a href="' . $delLink . '" onclick="javascript:if(!confirm(\'Are you sure you want to move this item to trash?\')) return false;" title="'.$title.'" />'.$link."</a>"; return $before . $link . $after; }Forum: Plugins
In reply to: Delete Post LinkSo the problem is with nonce..WP is checking for the nonce with param name = _wpnonce and pre-hash value to be in this format (without brackets of course ) [ ‘trash-‘ . $post->post_type . ‘_’ . $post->ID ]
change this line of code in function provided above by adanaahmad$delLink = wp_nonce_url( get_bloginfo('wpurl') . "/wp-admin/post.php?action=delete&post=" . $post->ID, 'delete-post_' . $post->ID);to {Changed nonce and action=trash}
$delLink = wp_nonce_url( get_bloginfo('wpurl') . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID);So your function becomes ..
function wp_delete_post_link($link = 'Delete This', $before = '', $after = '') { global $post; if ( $post->post_type == 'page' ) { if ( !current_user_can( 'edit_page', $post->ID ) ) return; } else { if ( !current_user_can( 'edit_post', $post->ID ) ) return; } $message = "Are your sure you want to delete ".get_the_title($post->ID)." ?"; $delLink = wp_nonce_url( get_bloginfo('wpurl') . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID); $link = "<a href='" . $delLink . "' title="Delete" />".$link.""; echo $before . $link . $after; }Forum: Fixing WordPress
In reply to: Your PHP installation appears to be missing the MySQL …I believe Mac already has a webserver by default.. dont think it is APache though..However you can install the Apache Linux version.
And yes.. its a webserver, a server that your browser connects to when you type the internet address..Hope it helps.Forum: Fixing WordPress
In reply to: Your PHP installation appears to be missing the MySQL …Guys the issue is that the Apache is not able to read the php.ini file, Do this and your problem will be solved.
Note : I copied the file at (following) three locations but you can try one at a time to see which is the correct place.
Copy the php.ini file from C:\Program Files\Apache2\Apache Group and paste it in
– C:\Windows\
– C:\Windows\System32\
– C:\Program Files\Apache Group\Apache2\bin
The file php.ini was already present in C:\Windows which was surely not done by me, so system internally placed it there.. and I am suspecting that should be the correct dir.
I think there is a logic in Apache to see if the ini file is already placed in C:\Windows, if not pick from Apache Group and copy it in c:\windows ..
so if you start the server before completing the changes to ini file.. it will place the ini file in windows dir and will not attempt to copy again after subsequent changesIn anycase, following above steps should resolve the problem
Guys the issue is that the Apache is not able to read the php.ini file, Do this and this will solve the problem.
Note : I copied the file at three locations but you can try one at a time to see which is the correct place.
Copy the php.ini file from C:\Program Files\Apache2\Apache Group and paste it in
– ..Apache Group\bin\
– C:\Windows\
– C:\Windows\System32\The file php.ini was already present in C:\Windows which was surely not done by me, so system internally placed it there.. and that should be the correct dir.
I think there will be a logic in Apache to see if the file is already placed in C:\Windows, if not pick from Apache Group and paste it .. so if you start the server before completing the changes.. it will place the file in ini file and will not attempt to copy again once you do more changes..
In anycase, following above steps should resolve the problem
Guys the issue is that the Apache is not able to read the php.ini file, Do this and this will solve the problem.
Note : I copied the file at three locations but you can try one at a time to see which is the correct place.
Copy the php.ini file from C:\Program Files\Apache2\Apache Group and paste it in
– ..Apache Group\bin\
– C:\Windows\
– C:\Windows\System32\The file php.ini was already present in C:\Windows which was surely not done by me, so system internally placed it there.. and that should be the correct dir.
I think there will be a logic in Apache to see if the file is already placed in C:\Windows, if not pick from Apache Group and paste it .. so if you start the server before completing the changes.. it will place the file in ini file and will not attempt to copy again once you do more changes..
In anycase, following above steps should resolve the problem