إنضمامك إلي منتديات استراحات زايد يحقق لك معرفة كل ماهو جديد في عالم الانترنت ...

انضم الينا
استراحات زايد الصفحة الرئيسية


إضافة رد
 
LinkBack أدوات الموضوع انواع عرض الموضوع
  #1  
قديم 03-07-2010, 09:00 PM
عضو ماسي
بيانات محروم.كوم
 رقم العضوية : 503
 تاريخ التسجيل : Dec 2007
الجنس : female
علم الدوله :
 المشاركات : 2,100,611
عدد الـنقاط :3341
 تقييم المستوى : 2139

Hi All,

I've been looking at the code to add new types of notifications and it looks like the current method of generating them is pretty inflexible in so far as it's impossible to write them without modifications to the source code.

I'll use a [related] bug that I filed to have join requests added as an example:

In looking at includes/class_bootstrap.php, you'll see the function build_notifications and a quick read of this functions shows you that you can only ever create customizations that are built from columns that exist in the user table. What this means is that any new notification type that you want to add requires , minimally, a modification of:
  • vb_user table (add a column)
  • modifying class_dm_user.php to include the new column in the $validfields array
  • modify class_dm_user.php to add post-delete behavior for the user (although this is required regardless)
But it also means that you need to constantly keep track of the state of the notification count. In my case of using the public usergroup join requests you also have to account for the following events:
  • user requests access to group
  • user cancels request to group
  • usergroup leader accepts request
  • usergroup rejects request
  • administrator accepts request (admincp)
  • administrator rejects request (admincp)
  • moderator accepts request (modcp)
  • moderator rejects request (modcp)
  • new usergroup leader is added to a public group
  • user is removed as a usergroup leader
  • public usergroup is deleted
  • public user group is made non-public
In the case of join requests, that's a lot of modifications to make and, quite frankly, in the case of the join requests code (which I'm finding, is a mess of non-pluggability) is completely impossible to do without modifications to several files.


This would have been MUCH easier for joinrequests if all of the existing code used called a global functions_usergrouprequest.php that provided for the adding of leaders, adding requests, accepting requests, etc. (or use a DM instead of a library).

Anyways, the net-net is that the current method of creating new types of notifications is pretty rigid and I'm wondering if any of you other programmers out there would like to see a more pluggable interface to create these things without having to make code changes.

I recognize that most programmers are uber and follow good OO or Modular programming methodologies, but the fact that adding these things requires mods to the class_dm_user.php file means that we can never create these things for our own mods without turning our products into hacks.

Note: there are hooks in the build_notifications function in includes/class_bootstrap.php file, but they are really just read-only hooks because the current system requires that the count of the notification types be a referenced in $vbulletin->userinfo[ ];

Your thoughts?

Cheers,
Dave.
__DEFINE_LIKE_SHARE__
رد مع اقتباس
إضافة رد

مواقع النشر (المفضلة)


تعليمات المشاركة
لا تستطيع إضافة مواضيع جديدة
لا تستطيع الرد على المواضيع
لا تستطيع إرفاق ملفات
لا تستطيع تعديل مشاركاتك

BB code is متاحة
كود [IMG] متاحة
كود HTML معطلة
Trackbacks are متاحة
Pingbacks are متاحة
Refbacks are متاحة



الساعة الآن 07:23 AM


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By Almuhajir

RSS RSS 2.0 XML MAP HTML