select * from xf_attachment where content_id = 11399;
+---------------+---------+--------------------+------------+-------------+-----------+--------------+------------+
| attachment_id | data_id | content_type | content_id | attach_date | temp_hash | unassociated | view_count |
+---------------+---------+--------------------+------------+-------------+-----------+--------------+------------+
| 61825 | 61856 | resource_version | 11399 | 1504199215 | | 0 | 56 |
| 167997 | 193756 | xfa_ec_rm_resource | 11399 | 1644407049 | | 0 | 21 |
| 167998 | 193757 | xfa_ec_rm_resource | 11399 | 1644407062 | | 0 | 21 |
| 167999 | 193758 | xfa_ec_rm_resource | 11399 | 1644407063 | | 0 | 21 |
| 168000 | 193759 | xfa_ec_rm_resource | 11399 | 1644407065 | | 0 | 21 |
+---------------+---------+--------------------+------------+-------------+-----------+--------------+------------+
select resource_update_id from xf_rm_resource_update where resource_id = {resource_id} order by post_date limit 1
update xf_attachment set content_type = 'xfa_ec_rm_resource', content_id = {resource_id} where content_id = {resource_update_id} and content_type = 'resource_update'
import mysql.connector
import sys
def main():
mydb = mysql.connector.connect(
host="localhost",
user="****",
password="****",
database="****"
)
cursor = mydb.cursor(buffered=True)
query = "select resource_id from xf_rm_resource where resource_type = 'download'"
for resource in stream_query(mydb, query):
resource_id = resource[0]
query = f"select resource_update_id from xf_rm_resource_update where resource_id = {resource_id} order by post_date limit 1"
cursor.execute(query)
resource_update_id = cursor.fetchone()[0]
print(f"Updating: {resource_id}. Resource Update ID: {resource_update_id}")
query = f"update xf_attachment set content_type = 'xfa_ec_rm_resource', content_id = {resource_id} where content_id = {resource_update_id} and content_type = 'resource_update'"
cursor.execute(query)
mydb.commit()
def stream_query(connection, query):
c = connection.cursor(buffered=True)
c.execute(query)
while True:
nextrows = c.fetchmany(128)
if not nextrows:
break
for row in nextrows:
yield row
if __name__ == "__main__":
main()
The XF1.5 version of this plugin basically automatically took any attached images from the post and put them in the cover. This new version doesnt seem to do that; which is mildly annoying but we would like to be able to automatically set this up for at least the existing posts.
Ah sorry, we are currently using XF 2 and this plugin.Hi
Thanks for your response, but are your sure for xf1.5 version? I have rewrite this addon based on xf1.5 feature so i don’t think i have used default post attachments to put them into cover slider
Regards
We use essential cookies to make this site work, and optional cookies to enhance your experience.