diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-22 07:34:42 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-22 07:34:42 +0200 |
commit | cbd7f8906674f6373f0dc6a8f79ecfcd4ce4bd8d (patch) | |
tree | f224e6b7737373e0a8432861154a6101da359fa2 /mod/locs.php | |
parent | 7834274bff5e86a7a0eb646f1319b5b9e4bac96f (diff) | |
parent | 146ff6f70308647b27374a1bba386c156498bd2e (diff) | |
download | volse-hubzilla-cbd7f8906674f6373f0dc6a8f79ecfcd4ce4bd8d.tar.gz volse-hubzilla-cbd7f8906674f6373f0dc6a8f79ecfcd4ce4bd8d.tar.bz2 volse-hubzilla-cbd7f8906674f6373f0dc6a8f79ecfcd4ce4bd8d.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod/locs.php')
-rw-r--r-- | mod/locs.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mod/locs.php b/mod/locs.php index 3f8bd9029..3c6a5da67 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -50,8 +50,17 @@ function locs_post(&$a) { return; } if(intval($r[0]['hubloc_primary'])) { - notice( t('Primary location cannot be removed.') . EOL); - return; + $x = q("select hubloc_id from hubloc where hubloc_primary = 1 and hubloc_hash = '%s'", + dbesc($channel['channel_hash']) + ); + if(! $x) { + notice( t('Location lookup failed.')); + return; + } + if(count($x) == 1) { + notice( t('Please select another location to become primary before removing the primary location.') . EOL); + return; + } } $r = q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d and hubloc_hash = '%s'", @@ -91,8 +100,6 @@ function locs_content(&$a) { $r[$x]['deleted'] = (intval($r[$x]['hubloc_deleted']) ? true : false); } - - $o = replace_macros(get_markup_template('locmanage.tpl'), array( '$header' => t('Manage Channel Locations'), '$loc' => t('Location (address)'), |