اذهب إلى المحتوى

Ibraheem Salem

الأعضاء
  • المساهمات

    2
  • تاريخ الانضمام

  • تاريخ آخر زيارة

إنجازات Ibraheem Salem

عضو مبتدئ

عضو مبتدئ (1/3)

0

السمعة بالموقع

  1. الحمد لله تمت برمجتها والحمد لله حليها وأح الأخوان زودني بالإضافة Comment Attachment وتم فهم فكرتها في عرض المرفقات وبرمجة الفانكشين الخاصة بي بالاعتماد على مبدأها وهذا كودها function insertAttacment_AVF_Replay( $comment ) { global $max_post_from_comment_converting; // global $wpdb; $AFV_attachmentId = get_comment_meta(get_comment_ID(), 'attachmentId', TRUE); if (get_comment_ID()<=$max_post_from_comment_converting){ if(is_numeric($AFV_attachmentId) && !empty($AFV_attachmentId)){ $AFV_url =get_site_url(); // link of site $sql = "SELECT * FROM wp_attach WHERE postid ='$AFV_attachmentId'"; $m = $wpdb->get_results($sql) or die(mysql_error()); if (count($m) > 0 ) { $contentInnerFinal.= "<div class='ShowAFV'>"; $contentInnerFinal.= "<h4><img src=".AFV__PLUGIN_URL."icon-cp.ico border=0/> المرفقات <small>(".count($m).") </small></h4> <ol style='list-style-type:square'>"; foreach ($m as $res) { $contentInnerFinal.= "<li><small><a href='".$AFV_url."?showAFV=".$res->attachmentid."' target=_blank class='AFV'>" . $res->filename. "</a> مشاهدة ".$res->counter."</small></li>"; } $contentInnerFinal.= "</ol></div>"; } $comment = $comment . $contentInnerFinal ; return $comment; } //return $comment; } return $comment; } add_filter('comment_text','insertAttacment_AVF_Replay', 10, 3);
  2. الحمد لله قمتُ بكتابة أول إضافة لي وهو يختص بعرض المرفقات المحولة والحمد لله تم إظهارها بنجاح في المواضيع ولكن أحاول أيضا تظهر في الردود وهذا كود الإضافة الخاصة بي من غير دالة الردود: // In the name of Allah the Merciful /** * @package attachmentfromvb * @version 1.0 */ /* Plugin Name: AFV Hima Plugin URI: https://www.facebook.com/ibraheem.salem Description: Show Attachment in Posts Author: Ibraheem Salem Version: 1.0 Author URI: https://www.facebook.com/ibraheem.salem License: GNU GPL */ // global varible $max_post_from_post_converting= "10"; $max_post_from_comment_converting= "2"; define( 'AFV__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'AFV__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// function AFV_Menu_Cp(){ // Menu panel of Plugin echo'<div align=center><hr>In the name of Allah the Merciful<hr><div>'; echo "<br>contron Panel Of AFV System <br>"; } //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// function AFV_Run_Cp(){ // Menu panel in wp-admin add_menu_page('Attachment Manage System AFV',' <font color=red><b>AFV</b></font>','manage_options','AFV_menu','AFV_Menu_Cp','../wp-content/plugins/AFVHima/icon-cp.ico',1); } add_action('admin_menu','AFV_Run_Cp'); //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// function insertAttacment_AVF_Posts($content) { global $max_post_from_post_converting; if(!is_feed() && !is_home() && get_the_ID()<$max_post_from_post_converting){ global $wpdb; $AFV_post_id = get_the_ID(); // postid $AFV_url =get_site_url(); // link of site $sql = "SELECT * FROM wp_attach WHERE postid ='$AFV_post_id'"; $m = $wpdb->get_results($sql) or die(mysql_error()); if (count($m) > 0 ) { $content.= "<div class='ShowAFV'>"; $content.= "<h4><img src=".AFV__PLUGIN_URL."icon-cp.ico border=0/> المرفقات <small>(".count($m).") </h4> <ol style='list-style-type:square'>"; $display_row = null; foreach ($m as $res) { $content.= "<li><a href='".$AFV_url."?showAFV=".$res->attachmentid."' target=_blank>" . $res->filename. "</a> مشاهدة ".$res->counter."</li>"; } $content.= "</ol></small></div>"; } return $content; } } if(get_the_ID()<$max_post_from_post_converting){ add_filter ('the_content', 'insertAttacment_AVF_Posts'); ;} // the_comment the_content //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// وأحد الأخوان ساعدني بإعطائي للهوك الخاص بمحتوى الرد add_filter('comment_text', 'FUNCTION_NAME', 1000); وحاولت أكود الدوال: function insertAttacment_AVF_Replay( ) { global $max_post_from_comment_converting; // global $wpdb; if (get_comment_ID()<=$max_post_from_comment_converting){ $con = get_comment_text( ); //ﻣﺤﺘﻮﻯ اﻟﺮﺩ $AFV_comment_id = get_comment_ID(); // ﺭﻗﻢ اﻟﺮﺩ $AFV_comment_id=intval($AFV_comment_id); $AFV_url =get_site_url(); // link of site $sql = "SELECT * FROM wp_attach WHERE postid ='$AFV_comment_id'"; $resut = $wpdb->get_results($sql) or die(mysql_error()); if (count($resut) > 0 ) { foreach ($resut as $res) { $all = "<br><small><a href='".$AFV_url."?showAFV=".$res->attachmentid."' target=_blank>" . $res->filename. "</a> مشاهدة ".$res->counter."<small><br>"; } // end foreach $all=$con.$all; return $all; } // end if (count($resut) > 0 ) else{ return get_comment_text( ); } // end else for if (count($resut) > 0 ) } // end if (get_comment_ID()<=$max_post_from_comment_converting){ else{ return get_comment_text( ); } // end else for if (get_comment_ID()<=$max_post_from_comment_converting){ } // end function add_filter('comment_text', 'insertAttacment_AVF_Replay');كتبت الدالة وأظن بأنّ خطواتي صحيحة، لكنيّ لا أدري أين الخلل. مفروض انه تطلع لي من القاعدة مدخلين كما بالصورة لكن يطلع آخر مدخل فقط مثل هذه الصورة وأيضًا يظهر المدخل الاخير برد ثاني لانه انا عندي بالقاعدة جدول المرفقات فيه postid يختص برقم الرد لديّ في القاعدة الرد رقم واحد له مدخلين والرد رقم اثنين ليس لها شيء ولكن يظهر المخرج بالقاعدة فيه. هناك أيضًا مشكلة بكود الدالة في أمر قاعدة البيانات لما احط المتغير الخاص برقم الرد تختفي الردود بمعنى في خطا بأمر قاعدة البيانات $sql = "SELECT * FROM wp_attach WHERE postid ='$AFV_post_id'";ولما اضع رقم صحيح بدال المغير مثلا رقم واحد تظهر لي بمشاكلها اللي فوق: $sql = "SELECT * FROM wp_attach WHERE postid ='1'";
×
×
  • أضف...