]> git.mxchange.org Git - friendica.git/commitdiff
add contact edit hooks
authorFriendika <info@friendika.com>
Fri, 7 Jan 2011 11:15:52 +0000 (03:15 -0800)
committerFriendika <info@friendika.com>
Fri, 7 Jan 2011 11:15:52 +0000 (03:15 -0800)
addon/README
mod/contacts.php
mod/dfrn_request.php

index b92b418b42d1d83193c50c9e4b2156d2dd3801bb..c6931c2b3ad510d88186bcc95ff6d216a16b5d6d 100644 (file)
@@ -130,6 +130,16 @@ Current hooks:
 'home_content' - called prior to output home page content, shown to unlogged users
        $b is (string) HTML of section region
 
+'contact_edit' - called when editing contact details on an individual from the Contacts page
+       $b is (array)
+               'contact' => contact record (array) of target contact
+               'output' => the (string) generated HTML of the contact edit page
+
+'contact_edit_post' - called when posting the contact edit page
+       $b is the $_POST array
+
+
+
 
 *** = subject to change
 
index 92bce0a73fef4f9b4577c4c9391dfa0557cc620d..7236a200d5a94b090fd76c67cb9bc7098eb29927 100644 (file)
@@ -40,6 +40,8 @@ function contacts_post(&$a) {
                return; // NOTREACHED
        }
 
+       call_hooks('contact_edit_post', $_POST);
+
        $profile_id = intval($_POST['profile-assign']);
        if($profile_id) {
                $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@@ -260,7 +262,11 @@ function contacts_content(&$a) {
 
                ));
 
-               return $o;
+               $arr = array('contact' => $r[0],'output' => $o);
+
+               call_hooks('contact_edit', $arr);
+
+               return $arr['output'];
 
        }
 
@@ -350,6 +356,7 @@ function contacts_content(&$a) {
                                '$url' => $url
                        ));
                }
+
                $o .= '<div id="contact-edit-end"></div>';
 
        }
index d5c5b83d5b861efc9086c2ed7008f92f37647552..6850f4be4dc3ed349891b68cb5943966d1e83d25 100644 (file)
@@ -256,7 +256,7 @@ function dfrn_request_post(&$a) {
                        FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
                        WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ");
                if(count($r)) {
-                       foreach($r as ($rr) {
+                       foreach($r as $rr) {
                                if(! $rr['rel']) {
                                        q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
                                                intval($rr['cid'])