aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-09 16:28:50 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-09 16:28:50 -0700
commitdb31c293a89294ffa59d613420274f500e60817b (patch)
treeb239e285cab437aa48a93d451299df0c8e07cdf2
parent110a39ae6129e4e0d6f752a9c2116972a8bb6251 (diff)
downloadvolse-hubzilla-db31c293a89294ffa59d613420274f500e60817b.tar.gz
volse-hubzilla-db31c293a89294ffa59d613420274f500e60817b.tar.bz2
volse-hubzilla-db31c293a89294ffa59d613420274f500e60817b.zip
new profile tables, profile clone
-rw-r--r--mod/profiles.php40
-rw-r--r--updates.sql19
-rw-r--r--view/profile_edit.tpl2
-rw-r--r--view/style.css5
4 files changed, 64 insertions, 2 deletions
diff --git a/mod/profiles.php b/mod/profiles.php
index e2cb02184..ea0b9afcb 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -131,6 +131,46 @@ function profiles_content(&$a) {
goaway($a->get_baseurl() . '/profiles');
}
+ if(($a->argc > 2) && ($a->argv[1] == 'clone')) {
+
+ $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
+ intval($_SESSION['uid']));
+ $num_profiles = count($r0);
+
+ $name = "Profile-" . ($num_profiles + 1);
+ $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ intval($_SESSION['uid']),
+ intval($a->argv[2])
+ );
+ if(! count($r1)) {
+ notice("Profile unavailable to clone." . EOL);
+ return;
+ }
+ unset($r1[0]['id']);
+ $r1[0]['is-default'] = 0;
+ $r1[0]['publish'] = 0;
+ $r1[0]['profile-name'] = dbesc($name);
+
+ $r2 = q("INSERT INTO `profile` (`"
+ . implode("`, `", array_keys($r1[0]))
+ . "`) VALUES ('"
+ . implode("', '", array_values($r1[0]))
+ . "')" );
+
+ $r3 = q("SELECT `id` FROM `profile` WHERE `uid` = %d AND `profile-name` = '%s' LIMIT 1",
+ intval($_SESSION['uid']),
+ dbesc($name)
+ );
+ $_SESSION['sysmsg'] .= "New profile created." . EOL;
+ if(count($r3) == 1)
+ goaway($a->get_baseurl() . '/profiles/' . $r3[0]['id']);
+ goaway($a->get_baseurl() . '/profiles');
+ return; // NOTREACHED
+ }
+
+
+
+
if(intval($a->argv[1])) {
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
diff --git a/updates.sql b/updates.sql
index 87d5e8b13..f74877d25 100644
--- a/updates.sql
+++ b/updates.sql
@@ -1,2 +1,19 @@
-ALTER TABLE `item` ADD `remote-id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `contact-id` ;
+|ALTER TABLE `item` ADD `remote-id` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `contact-id` ;
+
+ALTER TABLE `profile` ADD `politic` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `marital` ,
+ADD `religion` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `politic` ;
+
+ALTER TABLE `profile` ADD `sexual` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `marital` ;
+
+
+ALTER TABLE `profile` ADD `music` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `about` ,
+ADD `book` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `music` ,
+ADD `tv` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `book` ,
+ADD `film` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `tv` ,
+ADD `interest` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `film` ,
+ADD `romance` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `interest` ,
+ADD `work` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `romance` ;
+ALTER TABLE `profile` ADD `employer` CHAR( 255 ) NOT NULL AFTER `work` ,
+ADD `school` CHAR( 255 ) NOT NULL AFTER `employer` ;
+ALTER TABLE `profile` ADD `summary` CHAR( 255 ) NOT NULL AFTER `about` ;
diff --git a/view/profile_edit.tpl b/view/profile_edit.tpl
index 687432f75..251fdae14 100644
--- a/view/profile_edit.tpl
+++ b/view/profile_edit.tpl
@@ -1,5 +1,7 @@
<h1>Edit Profile Details</h1>
+<div id="profile-edit-clone-link-wrapper" ><a href="profiles/clone/$profile_id" id="profile-edit-clone-link" title="Create a new profile using these settings">Clone this profile</a></div>
+
$default
<div id="profile-edit-wrapper" >
diff --git a/view/style.css b/view/style.css
index 806d62aff..7b08e2269 100644
--- a/view/style.css
+++ b/view/style.css
@@ -274,7 +274,10 @@ input#dfrn-url {
}
-
+#profile-edit-clone-link-wrapper {
+ margin-left: 50px;
+ margin-bottom: 20px;
+}
#profile-edit-profile-name-label,
#profile-edit-name-label,